mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-07-20 18:22:30 -04:00
feat(desktop): Homebrew cask for macOS + tap automation on production releases (#6219)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
63
.github/workflows/promote.yml
vendored
63
.github/workflows/promote.yml
vendored
@@ -52,6 +52,8 @@ on:
|
||||
required: true
|
||||
DISCORD_WEBHOOK_ANDROID:
|
||||
required: false
|
||||
HOMEBREW_TAP_TOKEN:
|
||||
required: false
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ inputs.tag_name }}
|
||||
@@ -327,3 +329,64 @@ jobs:
|
||||
)
|
||||
|
||||
curl -H "Content-Type: application/json" -d "$PAYLOAD" "$DISCORD_WEBHOOK"
|
||||
|
||||
# Runs in-workflow rather than on `release: published` because the undraft above
|
||||
# uses github.token, whose events never trigger other workflows. Once the cask is
|
||||
# promoted to homebrew/cask, replace the tap PR with `brew bump-cask-pr`.
|
||||
update-homebrew-cask:
|
||||
if: ${{ inputs.channel == 'production' }}
|
||||
runs-on: ubuntu-24.04-arm
|
||||
needs: [ update-github-release ]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
ref: ${{ inputs.commit_sha || inputs.tag_name }}
|
||||
|
||||
- name: Render cask and open PR against meshtastic/homebrew-tap
|
||||
env:
|
||||
TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
||||
TAG: ${{ inputs.final_tag }}
|
||||
run: |
|
||||
if [[ -z "$TAP_TOKEN" ]]; then
|
||||
echo "HOMEBREW_TAP_TOKEN not set; skipping Homebrew cask update."
|
||||
exit 0
|
||||
fi
|
||||
# Tags cut before the template landed check out without it — skip, don't fail.
|
||||
if [[ ! -f .github/homebrew/meshtastic-desktop.rb ]]; then
|
||||
echo "Cask template not present at this tag; skipping Homebrew cask update."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
VERSION=${TAG#v}
|
||||
# GitHub rewrites spaces in asset names to dots:
|
||||
# "Meshtastic Desktop-X.dmg" is served as "Meshtastic.Desktop-X.dmg".
|
||||
# --retry-all-errors covers the brief 404 window while the undraft propagates.
|
||||
curl -fsSL --retry 5 --retry-delay 30 --retry-all-errors -o /tmp/app.dmg \
|
||||
"https://github.com/${{ github.repository }}/releases/download/${TAG}/Meshtastic.Desktop-${VERSION}.dmg"
|
||||
SHA256=$(sha256sum /tmp/app.dmg | cut -d' ' -f1)
|
||||
|
||||
sed -e "s/{{VERSION}}/${VERSION}/" -e "s/{{SHA256}}/${SHA256}/" \
|
||||
.github/homebrew/meshtastic-desktop.rb > /tmp/meshtastic-desktop.rb
|
||||
|
||||
# PR (not a direct push to main) so the tap's brew test-bot CI validates the bump.
|
||||
git clone "https://x-access-token:${TAP_TOKEN}@github.com/meshtastic/homebrew-tap.git" /tmp/tap
|
||||
cd /tmp/tap
|
||||
BRANCH="meshtastic-desktop-${VERSION}"
|
||||
git checkout -b "$BRANCH"
|
||||
mkdir -p Casks
|
||||
cp /tmp/meshtastic-desktop.rb Casks/meshtastic-desktop.rb
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add Casks/meshtastic-desktop.rb
|
||||
if git diff --cached --quiet; then
|
||||
echo "Cask already up to date."
|
||||
exit 0
|
||||
fi
|
||||
git commit -m "meshtastic-desktop ${VERSION}"
|
||||
git push -fu origin "$BRANCH"
|
||||
GH_TOKEN="$TAP_TOKEN" gh pr create --repo meshtastic/homebrew-tap \
|
||||
--head "$BRANCH" --base main \
|
||||
--title "meshtastic-desktop ${VERSION}" \
|
||||
--body "Automated cask bump for the ${TAG} production release of [Meshtastic-Android](https://github.com/${{ github.repository }}/releases/tag/${TAG})." \
|
||||
|| echo "PR already exists for $BRANCH; branch updated."
|
||||
|
||||
Reference in New Issue
Block a user