Skip to content

Commit 87f0674

Browse files
committed
update CI
1 parent f47db65 commit 87f0674

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/build-and-release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ on:
1818
# DEVELOPER_ID - Developer ID common name (e.g. "Your Name (XXXXXXXXXX)")
1919
# APPLE_ID - Apple ID email for notarization
2020
# APP_SPECIFIC_PASSWORD - App-specific password for notarization
21+
# HOMEBREW_APP_ID - GitHub App ID (installed on DDVTECH/homebrew-mistserver)
22+
# HOMEBREW_APP_PRIVATE_KEY - GitHub App private key (PEM)
2123

2224
env:
2325
XCODE_PROJECT: MistTray.xcodeproj
@@ -158,6 +160,39 @@ jobs:
158160
env:
159161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
160162

163+
- name: Generate GitHub App token
164+
if: startsWith(github.ref, 'refs/tags/')
165+
id: app-token
166+
uses: actions/create-github-app-token@v1
167+
with:
168+
app-id: ${{ secrets.HOMEBREW_APP_ID }}
169+
private-key: ${{ secrets.HOMEBREW_APP_PRIVATE_KEY }}
170+
owner: DDVTECH
171+
repositories: homebrew-mistserver
172+
173+
- name: Update Homebrew cask
174+
if: startsWith(github.ref, 'refs/tags/')
175+
run: |
176+
SHA256=$(awk '{print $1}' "$RUNNER_TEMP/$APP_NAME-$VERSION.zip.sha256")
177+
CLEAN_VERSION=${VERSION#v}
178+
179+
git clone --depth 1 https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/DDVTECH/homebrew-mistserver.git "$RUNNER_TEMP/homebrew-tap"
180+
cd "$RUNNER_TEMP/homebrew-tap"
181+
182+
sed -i '' -E "s|^ version \".*\"| version \"$CLEAN_VERSION\"|" Casks/misttray.rb
183+
sed -i '' -E "s|^ sha256 \".*\"| sha256 \"$SHA256\"|" Casks/misttray.rb
184+
185+
git config user.name "github-actions[bot]"
186+
git config user.email "github-actions[bot]@users.noreply.github.com"
187+
if [ -n "$(git diff)" ]; then
188+
git add Casks/misttray.rb
189+
git commit -m "Update MistTray to v$CLEAN_VERSION"
190+
git push origin HEAD:main
191+
echo "Updated Homebrew cask to v$CLEAN_VERSION (sha256: $SHA256)"
192+
else
193+
echo "Homebrew cask already up-to-date."
194+
fi
195+
161196
- name: Cleanup
162197
if: always()
163198
run: |

0 commit comments

Comments
 (0)