release: Capacium v0.16.0 (#4) #75
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: Bump Homebrew Tap | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| jobs: | |
| bump: | |
| # Hybrid mirror: this GitHub-only release pipeline is skipped on the | |
| # self-hosted Forgejo (no macOS/Windows runners). Runs on GitHub only. | |
| if: ${{ github.server_url == 'https://github.com' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Resolve tag | |
| id: tag | |
| run: echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" | |
| - name: Fetch source tarball and compute SHA256 | |
| id: hash | |
| run: | | |
| TAG="${{ steps.tag.outputs.tag }}" | |
| URL="https://github.com/${{ github.repository }}/archive/refs/tags/${TAG}.tar.gz" | |
| curl -sSL "$URL" -o capacium.tar.gz | |
| SHA=$(sha256sum capacium.tar.gz | awk '{print $1}') | |
| echo "sha=$SHA" >> "$GITHUB_OUTPUT" | |
| echo "url=$URL" >> "$GITHUB_OUTPUT" | |
| - name: Checkout tap | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Capacium/homebrew-tap | |
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| path: tap | |
| - name: Update formula | |
| run: | | |
| FILE="tap/Formula/capacium.rb" | |
| python3 - <<PY | |
| import re, pathlib | |
| p = pathlib.Path("$FILE") | |
| s = p.read_text() | |
| s = re.sub(r'url "[^"]+"', 'url "${{ steps.hash.outputs.url }}"', s, count=1) | |
| s = re.sub(r'sha256 "[a-f0-9]+"', 'sha256 "${{ steps.hash.outputs.sha }}"', s, count=1) | |
| p.write_text(s) | |
| PY | |
| cd tap | |
| git diff --stat | |
| - name: Commit and push | |
| working-directory: tap | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add Formula/capacium.rb | |
| if git diff --cached --quiet; then | |
| echo "No changes — formula already up to date." | |
| exit 0 | |
| fi | |
| git commit -m "capacium: update to ${{ steps.tag.outputs.tag }}" | |
| git push |