diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3d52f5b..d022536 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -213,6 +213,28 @@ jobs: gh release create "v$VERSION" --verify-tag ${draft[@]+"${draft[@]}"} \ --title "Pladder $VERSION" --notes-file "$RUNNER_TEMP/notes.md" \ dist/release/Pladder.dmg dist/release/Pladder.dmg.sha256 dist/release/appcast.xml + - name: Bump the Homebrew cask + # The release is out by now, so a failed bump leaves the run green and + # is done by hand (INSTALL.md, "Homebrew"). A draft's DMG is not public, + # so the cask would point at a 404. + if: ${{ !inputs.draft }} + continue-on-error: true + env: + GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} + run: | + if [[ -z "$GH_TOKEN" ]]; then + echo "::error::No HOMEBREW_TAP_TOKEN in the release environment; bump the cask by hand." + exit 1 + fi + sha=$(cut -d ' ' -f 1 dist/release/Pladder.dmg.sha256) + ./scripts/cask.sh "$VERSION" "$sha" > "$RUNNER_TEMP/pladder.rb" + api=repos/dinooo13/homebrew-tap/contents/Casks/pladder.rb + # The first release creates the file; every later one replaces it. + old=() + if sha_old=$(gh api "$api" --jq .sha 2>/dev/null); then old=(-f sha="$sha_old"); fi + gh api -X PUT "$api" -f message="pladder $VERSION" ${old[@]+"${old[@]}"} \ + -f content="$(base64 < "$RUNNER_TEMP/pladder.rb" | tr -d '\n')" \ + --jq .commit.html_url - name: Delete the tag of a release that was not published # Deleting is allowed where creating is not, so this works even after # main's workflows changed. A release that exists keeps its tag. diff --git a/CLAUDE.md b/CLAUDE.md index 5117a9c..8bbbea9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -29,6 +29,7 @@ swift test # unit tests, well under a second ./scripts/release.sh # Developer ID, notarised, stapled → dist/release/Pladder.dmg; publishes nothing ./scripts/changelog.sh [] # the release notes release.yml publishes, from the commit subjects ./scripts/appcast.sh # sign the DMG for Sparkle and print the release's appcast.xml +./scripts/cask.sh [] # the Homebrew tap's Casks/pladder.rb, from scripts/pladder.rb swift run -c release pladder-cli