Bump version to 0.3.0 #10
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
| # Publishes a reviewer Docker image to GitHub Container Registry (GHCR), | |
| # builds release binaries, and creates a GitHub Release when a tag matching | |
| # `v*` is pushed. | |
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| binary: | |
| name: Build binary (${{ matrix.name }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: Linux (x86_64) | |
| runner: ubuntu-24.04 | |
| artifact: reviewer-linux-x86_64 | |
| target: x86_64-unknown-linux-gnu | |
| - name: macOS (arm64) | |
| runner: macos-15 | |
| artifact: reviewer-macos-arm64 | |
| target: aarch64-apple-darwin | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| targets: ${{ matrix.target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Run tests | |
| run: cargo test | |
| - name: Build release binary | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Stage binary | |
| run: | | |
| set -eu | |
| mkdir -p staging | |
| cp target/${{ matrix.target }}/release/reviewer staging/ | |
| cp action.yml staging/ | |
| cp README.md staging/ | |
| echo "${{ github.ref_name }}" > staging/VERSION | |
| echo "${{ github.sha }}" > staging/COMMIT | |
| - name: Create archive | |
| run: | | |
| set -eu | |
| cd staging | |
| tar -czf ../${{ matrix.artifact }}-${{ github.ref_name }}.tar.gz * | |
| cd .. | |
| ls -lh ${{ matrix.artifact }}-${{ github.ref_name }}.tar.gz | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: ${{ matrix.artifact }}-${{ github.ref_name }}.tar.gz | |
| retention-days: 7 | |
| docker: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| packages: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=edge | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| release: | |
| needs: [binary, docker] | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download binary artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| pattern: reviewer-* | |
| merge-multiple: true | |
| - name: Generate checksums | |
| run: | | |
| set -eu | |
| mkdir -p release | |
| find artifacts -name '*.tar.gz' -exec cp {} release/ \; | |
| cd release | |
| sha256sum * > SHA256SUMS.txt | |
| ls -lh | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| prerelease: ${{ contains(github.ref_name, '-') }} | |
| files: release/* |