Merge pull request #180 from taras/release/bump-0.6.0 #13
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: | |
| # Refuse a tag the manifests do not declare (spec §2) — the binary's | |
| # --version comes from packages/cli/deno.json. On failure, the mistake is made | |
| # visible on the release itself, not just in this log. | |
| preflight: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| - name: Tag matches the manifest version | |
| run: | | |
| TAG="${{ github.ref_name }}" | |
| declared="$(jq -r .version packages/cli/deno.json)" | |
| if [ "v$declared" != "$TAG" ]; then | |
| echo "::error::packages/cli/deno.json declares $declared but the tag is $TAG — bump the manifests first" | |
| exit 1 | |
| fi | |
| - name: Flag the release when the tag cannot build | |
| if: failure() | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -u | |
| TAG="${{ github.ref_name }}" | |
| gh release view "$TAG" --json body --jq .body > /tmp/body.md 2>/dev/null || exit 0 | |
| { | |
| echo "> [!CAUTION]" | |
| echo "> This release did not build: the manifests do not declare \`${TAG#v}\`." | |
| echo "> Delete this release and its tag, run \`deno task bump ${TAG#v}\`, merge" | |
| echo "> the bump, and release again (release spec §2)." | |
| echo | |
| cat /tmp/body.md | |
| } > /tmp/new.md | |
| gh release edit "$TAG" --prerelease \ | |
| --title "$TAG — failed: manifests not bumped" \ | |
| --notes-file /tmp/new.md || true | |
| build: | |
| name: Compile ${{ matrix.target }} | |
| needs: preflight | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: aarch64-apple-darwin | |
| artifact: xmd-aarch64-apple-darwin | |
| - target: x86_64-apple-darwin | |
| artifact: xmd-x86_64-apple-darwin | |
| - target: x86_64-unknown-linux-gnu | |
| artifact: xmd-x86_64-unknown-linux-gnu | |
| - target: aarch64-unknown-linux-gnu | |
| artifact: xmd-aarch64-unknown-linux-gnu | |
| - target: x86_64-pc-windows-msvc | |
| artifact: xmd-x86_64-pc-windows-msvc.exe | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| - uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3 | |
| with: | |
| deno-version: v2.9.1 | |
| - name: Compile ${{ matrix.target }} | |
| run: | | |
| deno compile \ | |
| --node-modules-dir=none \ | |
| --exclude-unused-npm \ | |
| --allow-all \ | |
| --include packages/code-review-agent \ | |
| --target ${{ matrix.target }} \ | |
| --output dist/${{ matrix.artifact }} \ | |
| packages/cli/src/cli.ts | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: dist/${{ matrix.artifact }} | |
| if-no-files-found: error | |
| release: | |
| name: Publish release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all binaries | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Generate checksums | |
| working-directory: dist | |
| run: sha256sum xmd-* > checksums.txt | |
| - name: Publish to GitHub Release | |
| uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| draft: false | |
| fail_on_unmatched_files: true | |
| files: | | |
| dist/xmd-* | |
| dist/checksums.txt |