ci: add automated homebrew-tap update on release and docs in skill

This commit is contained in:
gitea committed 2026-09-19 10:40:29 +08:00
1 parent f02c5a3b5f
commit 7bbddd7aba
2 files changed
+61 -4

No files matched your search

+55
View File
@@ -301,3 +301,58 @@ jobs:
fi
done
echo "✓ Gitea publishing step completed!"
update-brew-tap:
name: 🍺 Update Homebrew Tap
needs: [build-and-publish-github, publish-gitea]
if: ${{ !cancelled() && needs.build-and-publish-github.result == 'success' }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout Homebrew Tap
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
repository: yunyingk/homebrew-tap
token: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
path: tap
- name: Download checksums from GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG_NAME="${{ github.event.inputs.tag || github.ref_name }}"
gh release download "${TAG_NAME}" \
--repo "${GITHUB_REPOSITORY}" \
--pattern 'checksums.txt' \
--dir . \
--clobber
- name: Update Formula
run: |
RAW_TAG="${{ github.event.inputs.tag || github.ref_name }}"
VERSION="${RAW_TAG#v}"
ARM64_SHA=$(grep 'seal-use-darwin-arm64.tar.gz' checksums.txt | awk '{print $1}')
if [ -z "$ARM64_SHA" ]; then
echo "::error::Could not find sha256 for seal-use-darwin-arm64.tar.gz"
exit 1
fi
echo "Updating Formula to version ${VERSION} with sha256 ${ARM64_SHA}"
FORMULA_FILE="tap/Formula/seal-use.rb"
sed -i -E "s/version \"[^\"]+\"/version \"${VERSION}\"/" "$FORMULA_FILE"
sed -i -E "s/sha256 \"[^\"]+\"/sha256 \"${ARM64_SHA}\"/" "$FORMULA_FILE"
cd tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if git diff --quiet; then
echo "No changes to Formula, skipping commit."
else
git add Formula/seal-use.rb
git commit -m "chore(release): bump seal-use to ${VERSION}"
git push origin main
echo "✓ Homebrew Tap formula updated successfully!"
fi