fixes #9
Workflow file for this run
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: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| archive: tar.gz | |
| bin: cli | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| archive: tar.gz | |
| bin: cli | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| archive: tar.gz | |
| bin: cli | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| archive: tar.gz | |
| bin: cli | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| archive: zip | |
| bin: cli.exe | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install cross (Linux only) | |
| if: runner.os == 'Linux' | |
| run: cargo install cross | |
| - name: Build | |
| shell: bash | |
| run: | | |
| if [[ "$RUNNER_OS" == "Linux" ]]; then | |
| cross build --release --target ${{ matrix.target }} | |
| else | |
| cargo build --release --target ${{ matrix.target }} | |
| fi | |
| - name: Package (Unix) | |
| if: matrix.archive == 'tar.gz' | |
| run: | | |
| mkdir dist | |
| cp target/${{ matrix.target }}/release/${{ matrix.bin }} dist/ | |
| tar -czf nuvix-${{ matrix.target }}.tar.gz -C dist ${{ matrix.bin }} | |
| - name: Package (Windows) | |
| if: matrix.archive == 'zip' | |
| shell: pwsh | |
| run: | | |
| mkdir dist | |
| copy target/${{ matrix.target }}/release/${{ matrix.bin }} dist\ | |
| Compress-Archive dist\${{ matrix.bin }} nuvix-${{ matrix.target }}.zip | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuvix-${{ matrix.target }} | |
| path: | | |
| nuvix-${{ matrix.target }}.tar.gz | |
| nuvix-${{ matrix.target }}.zip | |
| if-no-files-found: ignore | |
| release: | |
| name: Publish GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Prepare files | |
| run: | | |
| mkdir release | |
| find dist -type f \( -name "*.tar.gz" -o -name "*.zip" \) -exec cp {} release/ \; | |
| cd release | |
| sha256sum * > checksums.txt | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release/* | |
| generate_release_notes: true | |
| npm: | |
| name: Publish npm | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| - name: Set version from tag | |
| working-directory: npm | |
| run: | | |
| TAG="${GITHUB_REF_NAME#v}" | |
| npm version --no-git-tag-version "$TAG" | |
| - name: Publish | |
| working-directory: npm | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |