fix: revert to stable Rust versions in CI and Docker #5
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*' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract version | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.ref }} | |
| name: Release ${{ steps.get_version.outputs.VERSION }} | |
| body: | | |
| # DiffScope ${{ steps.get_version.outputs.VERSION }} | |
| See [CHANGELOG.md](https://github.com/haasonsaas/diffscope/blob/main/CHANGELOG.md) for details. | |
| ## 🚀 Installation | |
| ### Quick install (Linux/macOS): | |
| ```bash | |
| curl -sSL https://raw.githubusercontent.com/haasonsaas/diffscope/main/install.sh | sh | |
| ``` | |
| ### Quick install (Windows): | |
| ```powershell | |
| iwr -useb https://raw.githubusercontent.com/haasonsaas/diffscope/main/install.ps1 | iex | |
| ``` | |
| ### Manual installation: | |
| Download the appropriate binary below for your platform and add it to your PATH. | |
| ## 📦 Checksums | |
| SHA256 checksums will be available once all builds complete. | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| build-release: | |
| name: Build Release | |
| needs: create-release | |
| strategy: | |
| matrix: | |
| include: | |
| # Linux | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| artifact_name: diffscope | |
| asset_name: diffscope-x86_64-unknown-linux-gnu | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| artifact_name: diffscope | |
| asset_name: diffscope-x86_64-unknown-linux-musl | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| artifact_name: diffscope | |
| asset_name: diffscope-aarch64-unknown-linux-gnu | |
| # macOS | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact_name: diffscope | |
| asset_name: diffscope-x86_64-apple-darwin | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact_name: diffscope | |
| asset_name: diffscope-aarch64-apple-darwin | |
| # Windows | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact_name: diffscope.exe | |
| asset_name: diffscope-x86_64-pc-windows-msvc.exe | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install cross-compilation tools | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Install musl tools | |
| if: matrix.target == 'x86_64-unknown-linux-musl' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Strip binary (Linux and macOS) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }} | |
| - name: Create checksum (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| cd target/${{ matrix.target }}/release/ | |
| sha256sum ${{ matrix.artifact_name }} > ${{ matrix.asset_name }}.sha256 | |
| - name: Create checksum (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| cd target/${{ matrix.target }}/release/ | |
| (Get-FileHash -Algorithm SHA256 ${{ matrix.artifact_name }}).Hash + " " + "${{ matrix.artifact_name }}" | Out-File -Encoding ASCII ${{ matrix.asset_name }}.sha256 | |
| - name: Upload Release Asset | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.ref }} | |
| files: | | |
| target/${{ matrix.target }}/release/${{ matrix.artifact_name }} | |
| target/${{ matrix.target }}/release/${{ matrix.asset_name }}.sha256 | |
| build-docker: | |
| name: Build and Push Docker Image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract version from tag | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| ghcr.io/haasonsaas/diffscope:latest | |
| ghcr.io/haasonsaas/diffscope:${{ steps.get_version.outputs.VERSION }} | |
| # Homebrew formula update can be added later when tap repository is created | |
| # For now, users can use the install script or download binaries directly |