bump version #12
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[0-9].[0-9]+.[0-9]+*" | |
| jobs: | |
| build: | |
| name: ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| - os: windows-latest | |
| target: x86_64-pc-windows-gnu | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Rustup the specific target | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build | |
| shell: bash | |
| run: | | |
| cargo build --release --locked --target ${{ matrix.target }} | |
| if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
| echo "BIN_NAME=roy.exe" >> $GITHUB_ENV | |
| else | |
| echo "BIN_NAME=roy" >> $GITHUB_ENV | |
| fi | |
| - name: Create build artifact | |
| shell: bash | |
| run: | | |
| staging="roy-$GITHUB_REF_NAME-${{ matrix.target }}" | |
| mkdir -p "$staging" | |
| echo "STAGING=$staging" >> $GITHUB_ENV | |
| cp -r {README.md,LICENSE} "$staging" | |
| if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
| cp "target/${{ matrix.target }}/release/roy.exe" "$staging/" | |
| 7z a "$staging.zip" "$staging" | |
| echo "ASSET=$staging.zip" >> $GITHUB_ENV | |
| else | |
| cp "target/${{ matrix.target }}/release/roy" "$staging/" | |
| tar czf "$staging.tar.gz" "$staging" | |
| echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV | |
| fi | |
| - name: Upload artifact from ${{ matrix.os }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.STAGING }} | |
| path: ${{ env.ASSET }} | |
| retention-days: 1 | |
| overwrite: true | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./dist | |
| merge-multiple: true # put all the artifact in the same folder at ./dist | |
| - name: List all downloaded files to verify | |
| run: | | |
| echo "Listing all files in the downloaded artifacts directory:" | |
| ls -R ./dist | |
| - name: Create GitHub Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| artifacts: "./dist/*" | |
| generateReleaseNotes: true | |
| publish: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Publish to crates.io | |
| run: cargo publish --token ${{ secrets.CRATES_IO_API_TOKEN }} |