Skip to content
This repository was archived by the owner on Jan 1, 2026. It is now read-only.

Commit 1ff1cea

Browse files
committed
fix: actions to homebrew cask update
1 parent e857806 commit 1ff1cea

1 file changed

Lines changed: 29 additions & 16 deletions

File tree

.github/workflows/release.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: Release and Update Homebrew Cask
22

33
on:
44
push:
@@ -11,51 +11,64 @@ jobs:
1111
permissions:
1212
contents: write
1313
pull-requests: write
14+
outputs:
15+
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
1416
steps:
15-
- uses: actions/checkout@v4
16-
- name: Install Node.js
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
persist-credentials: false
21+
- name: Setup Node.js
1722
uses: actions/setup-node@v4
1823
with:
1924
node-version: 21
20-
- name: Install Dependencies
25+
- name: Install dependencies
2126
run: npm install
22-
- name: Release
23-
run: npx semantic-release
27+
- name: Semantic Release
28+
id: semantic
29+
uses: cycjimmy/semantic-release-action@v4
30+
with:
31+
branch: master
2432
env:
25-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
2635
update-homebrew-cask:
2736
name: Update Homebrew Cask
2837
needs: release
38+
if: needs.release.outputs.new_release_version
2939
runs-on: ubuntu-latest
3040
steps:
3141
- name: Checkout repository
3242
uses: actions/checkout@v4
3343

34-
- name: Get new version tag
35-
run: echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
44+
- name: Set Release Version Env
45+
run: echo "RELEASE_VERSION=${{ needs.release.outputs.new_release_version }}" >> $GITHUB_ENV
3646

3747
- name: Download release assets
3848
run: |
39-
# FIX: Use the dynamic release tag instead of 'master'
40-
gh release download ${{ env.RELEASE_VERSION }} --pattern 'Floatplane-*.dmg'
49+
gh release download ${{ env.RELEASE_VERSION }} --pattern "Floatplane-*.dmg" --repo ${{ github.repository }}
4150
env:
4251
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4352

4453
- name: Calculate checksums
4554
run: |
46-
echo "ARM64_SHA=$(shasum -a 256 Floatplane-${{ env.RELEASE_VERSION }}-arm64.dmg | cut -d' ' -f1)" >> $GITHUB_ENV
47-
echo "X64_SHA=$(shasum -a 256 Floatplane-${{ env.RELEASE_VERSION }}-x64.dmg | cut -d' ' -f1)" >> $GITHUB_ENV
55+
VERSION_NUMBER=${{ env.RELEASE_VERSION }}
56+
# Remove 'v' prefix for filename, which matches your electron-builder artifactName
57+
VERSION_NUMBER_NO_V=${VERSION_NUMBER#v}
58+
echo "ARM64_SHA=$(shasum -a 256 Floatplane-${VERSION_NUMBER_NO_V}-arm64.dmg | cut -d' ' -f1)" >> $GITHUB_ENV
59+
echo "X64_SHA=$(shasum -a 256 Floatplane-${VERSION_NUMBER_NO_V}-x64.dmg | cut -d' ' -f1)" >> $GITHUB_ENV
4860
4961
- name: Clone Homebrew tap repository
5062
run: |
51-
git clone https://${{ secrets.GITHUB_TOKEN }}@github.com/andrinoff/homebrew-floatplane.git
63+
git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/andrinoff/homebrew-floatplane.git
5264
5365
- name: Update Cask file
5466
run: |
5567
cd homebrew-floatplane
56-
# Remove 'v' prefix from version tag for the cask file
5768
VERSION_NUMBER=${{ env.RELEASE_VERSION }}
58-
sed -i "s/version \".*\"/version \"${VERSION_NUMBER#v}\"/" Casks/floatplane.rb
69+
# Remove 'v' prefix from version tag for the cask file
70+
VERSION_NUMBER_NO_V=${VERSION_NUMBER#v}
71+
sed -i "s/version \".*\"/version \"${VERSION_NUMBER_NO_V}\"/" Casks/floatplane.rb
5972
sed -i "/on_arm do/,/end/ s/sha256 \".*\"/sha256 \"${{ env.ARM64_SHA }}\"/" Casks/floatplane.rb
6073
sed -i "/on_intel do/,/end/ s/sha256 \".*\"/sha256 \"${{ env.X64_SHA }}\"/" Casks/floatplane.rb
6174

0 commit comments

Comments
 (0)