componentize-qjs-cli 0.2.0

CLI for converting JavaScript to WebAssembly components using QuickJS
Documentation
name: Release-plz

on:
  push:
    branches: [main]

permissions: {}

jobs:
  release-plz-release:
    name: Release-plz release
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: read
    outputs:
      releases_created: ${{ steps.release_plz.outputs.releases_created }}
      release_tag: ${{ steps.release.outputs.release_tag }}
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-depth: 0

      - name: Install Rust
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          targets: wasm32-wasip2

      - name: Install cargo-binstall
        uses: cargo-bins/cargo-binstall@4852a15cf01e4f33958ce547326406fe78f27c38 # v1.19.0

      - name: Cache cargo
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

      - name: Install SBOM tools
        run: |
          cargo binstall cargo-auditable --force
          cargo binstall auditable2cdx --force

      - name: Build runtime for packaging
        shell: bash
        run: |
          bash .github/scripts/prepare-runtime-artifacts.sh \
            target/release-plz-package \
            crates/core/prebuilt \
            runtime.wasm=runtime.wasm \
            runtime-opt-size.wasm=runtime-opt-size.wasm

      - name: Run release-plz
        id: release_plz
        uses: release-plz/action@1528104d2ca23787631a1c1f022abb64b34c1e11 # v0.5.128
        with:
          command: release
          forge: github
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

      - name: Extract release tag
        if: steps.release_plz.outputs.releases_created == 'true'
        id: release
        shell: bash
        env:
          RELEASES: ${{ steps.release_plz.outputs.releases }}
        run: |
          tag=$(jq -r 'map(select(.package_name == "componentize-qjs-cli"))[0].tag // map(select((.tag // "") | startswith("v")))[0].tag // empty' <<< "$RELEASES")
          if [ -z "$tag" ]; then
            echo "release-plz did not report a v* release tag; skipping CLI/runtime publish"
            echo "$RELEASES"
            exit 0
          fi
          echo "release_tag=${tag}" >> "$GITHUB_OUTPUT"

  publish-cli:
    name: Publish CLI release assets
    needs: release-plz-release
    if: needs.release-plz-release.outputs.releases_created == 'true' && needs.release-plz-release.outputs.release_tag != ''
    permissions:
      contents: write
      id-token: write
      attestations: write
    uses: ./.github/workflows/cli-release.yml
    with:
      release_tag: ${{ needs.release-plz-release.outputs.release_tag }}

  publish-runtime:
    name: Publish runtime Wasm
    needs: release-plz-release
    if: needs.release-plz-release.outputs.releases_created == 'true' && needs.release-plz-release.outputs.release_tag != ''
    permissions:
      actions: read
      contents: read
      id-token: write
      packages: write
    uses: ./.github/workflows/runtime-publish.yml
    with:
      release_tag: ${{ needs.release-plz-release.outputs.release_tag }}

  publish-npm:
    name: Publish npm packages
    needs: release-plz-release
    if: needs.release-plz-release.outputs.releases_created == 'true' && needs.release-plz-release.outputs.release_tag != ''
    permissions:
      contents: read
      id-token: write
    uses: ./.github/workflows/npm-publish.yml
    with:
      release_tag: ${{ needs.release-plz-release.outputs.release_tag }}
    secrets:
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

  release-plz-pr:
    name: Release-plz PR
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    concurrency:
      group: release-plz-pr-${{ github.ref }}
      cancel-in-progress: false
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-depth: 0

      - name: Install Rust
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          targets: wasm32-wasip2

      - name: Cache cargo
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

      - name: Run release-plz
        uses: release-plz/action@1528104d2ca23787631a1c1f022abb64b34c1e11 # v0.5.128
        with:
          command: release-pr
          forge: github
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}