fix(github): fix release pipeline #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| jobs: | |
| build-matrix: | |
| name: Build matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| build_matrix: ${{ steps.set-matrix.outputs.build_matrix }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| sparse-checkout: | | |
| .github/workflows/matrix.json | |
| sparse-checkout-cone-mode: false | |
| - id: set-matrix | |
| shell: bash | |
| run: | | |
| if [ "$ACT" == true ]; then | |
| echo "build_matrix=$( cat .github/workflows/matrix.json | jq --monochrome-output --compact-output '[.[] | select(.RUN_LOCALLY)]' )" >> $GITHUB_OUTPUT | |
| else | |
| echo "build_matrix=$( cat .github/workflows/matrix.json | jq --monochrome-output --compact-output )" >> $GITHUB_OUTPUT | |
| fi | |
| publish-npm-binaries: | |
| name: Publish npm binaries | |
| needs: build-matrix | |
| runs-on: ${{ matrix.build.OS }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build: ${{ fromJson(needs.build-matrix.outputs.build_matrix) }} | |
| steps: | |
| - name: Debug workflow values | |
| shell: bash | |
| run: | | |
| echo "env.ACT : ${{ env.ACT }}" | |
| echo "matrix.build.NAME : ${{ matrix.build.NAME }}" | |
| echo "matrix.build.OS : ${{ matrix.build.OS }}" | |
| echo "matrix.build.RUN_LOCALLY : ${{ matrix.build.RUN_LOCALLY }}" | |
| echo "matrix.build.TARGET : ${{ matrix.build.TARGET }}" | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install node | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 24 | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Install rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.build.TARGET }} | |
| components: rustfmt, clippy | |
| - name: Set up cargo cache | |
| uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| - name: Install just | |
| uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0 | |
| with: | |
| just-version: 1.35.0 | |
| - name: Install cross | |
| if: ${{ !env.ACT && matrix.build.OS == 'ubuntu-22.04' }} | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cross | |
| - name: Build rust binary (cross) | |
| if: ${{ !env.ACT && matrix.build.OS == 'ubuntu-22.04' }} | |
| shell: bash | |
| run: cross build --release --locked --target ${{ matrix.build.TARGET }} | |
| - name: Build rust binary (cargo) | |
| if: ${{ env.ACT || matrix.build.OS != 'ubuntu-22.04' }} | |
| shell: bash | |
| run: cargo build --release --locked --target ${{ matrix.build.TARGET }} | |
| - name: (Test) Publish rust binary package to npm | |
| shell: bash | |
| run: | | |
| just --dotenv-filename .env.${{ matrix.build.NAME }} create-npm-binary-package | |
| publish-npm-base: | |
| name: (Test) Publish npm package | |
| needs: publish-npm-binaries | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install node | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 24 | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Install just | |
| uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0 | |
| with: | |
| just-version: 1.35.0 | |
| - name: (Test) Publish the package | |
| shell: bash | |
| run: | | |
| npm install | |
| just --dotenv-filename .env.linux-x64-glibc create-npm-root-package |