This repository was archived by the owner on Oct 9, 2026. It is now read-only.
Repository navigation
small readme fix #25
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: | |
| - "[0-9]+.*" | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: aarch64-apple-darwin | |
| os: macos-14 | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-22.04 | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 | |
| with: | |
| bun-version: 1.3.10 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Build and package | |
| env: | |
| TARGET: ${{ matrix.target }} | |
| RELEASE_TAG: ${{ github.ref_type == 'tag' && github.ref_name || '' }} | |
| run: | | |
| version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "diffr-cli") | .version') | |
| if [ -n "$RELEASE_TAG" ] && [ "$RELEASE_TAG" != "$version" ]; then | |
| echo "Tag $RELEASE_TAG does not match Cargo version $version" >&2 | |
| exit 1 | |
| fi | |
| cargo xtask install --root "$RUNNER_TEMP/install" | |
| python3 scripts/release.py pack --version "$version" --target "$TARGET" --install "$RUNNER_TEMP/install" --output dist | |
| - name: Verify extracted archive without Bun or checkout assets | |
| run: | | |
| mkdir -p "$RUNNER_TEMP/extracted/bin" | |
| tar -xzf dist/*.tar.gz -C "$RUNNER_TEMP/extracted/bin" | |
| python3 xtask/tests/smoke_install.py "$RUNNER_TEMP/extracted" | |
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: ${{ matrix.target }} | |
| path: dist/*.tar.gz | |
| if-no-files-found: error | |
| prepare: | |
| needs: build | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Generate checksums and Homebrew formula | |
| run: | | |
| version=$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -1) | |
| python3 scripts/release.py formula --version "$version" --output dist | |
| (cd dist && sha256sum --check SHA256SUMS) | |
| ruby -c dist/diffr.rb | |
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: release | |
| path: dist/* | |
| if-no-files-found: error | |
| homebrew: | |
| needs: prepare | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-14, ubuntu-22.04] | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 15 | |
| env: | |
| HOMEBREW_NO_AUTO_UPDATE: '1' | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: release | |
| path: dist | |
| - name: Install and test the formula against staged archives | |
| shell: bash | |
| run: | | |
| if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then | |
| eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
| fi | |
| tap="$(brew --repository)/Library/Taps/devdotfast/homebrew-tap" | |
| mkdir -p "$tap/Formula" | |
| python3 - "$tap/Formula/diffr.rb" <<'PYTHON' | |
| from pathlib import Path | |
| import re | |
| import sys | |
| formula = Path("dist/diffr.rb").read_text() | |
| formula = re.sub(r'https://github.com/devdotfast/diffr/releases/download/[^/]+/', Path("dist").resolve().as_uri() + "/", formula) | |
| Path(sys.argv[1]).write_text(formula) | |
| PYTHON | |
| brew install devdotfast/tap/diffr | |
| brew test devdotfast/tap/diffr | |
| python3 - "$tap/Formula/diffr.rb" <<'PYTHON' | |
| from pathlib import Path | |
| import sys | |
| path = Path(sys.argv[1]) | |
| path.write_text(path.read_text().replace(' license ', ' revision 1\n license ', 1)) | |
| PYTHON | |
| brew upgrade devdotfast/tap/diffr | |
| brew test devdotfast/tap/diffr | |
| python3 xtask/tests/smoke_install.py "$(brew --prefix devdotfast/tap/diffr)" | |
| brew uninstall devdotfast/tap/diffr | |
| packaging: | |
| name: Release packaging | |
| if: always() | |
| needs: [build, prepare, homebrew] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Require all packaging checks to pass | |
| env: | |
| BUILD: ${{ needs.build.result }} | |
| PREPARE: ${{ needs.prepare.result }} | |
| HOMEBREW: ${{ needs.homebrew.result }} | |
| run: test "$BUILD" = success && test "$PREPARE" = success && test "$HOMEBREW" = success | |
| publish: | |
| if: github.event_name == 'push' && github.ref_type == 'tag' | |
| needs: packaging | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: release | |
| path: dist | |
| - name: Publish complete release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| RELEASE_TAG: ${{ github.ref_name }} | |
| run: | | |
| gh release create "$RELEASE_TAG" dist/* --verify-tag --draft --title "$RELEASE_TAG" --generate-notes | |
| gh release edit "$RELEASE_TAG" --draft=false --latest |