Skip to content

Commit e931a91

Browse files
committed
Add GitHub Actions release workflow
Automates: - Build Tauri app on macOS (Apple Silicon) - Create GitHub release with DMG - Update Homebrew cask (requires HOMEBREW_TAP_TOKEN secret)
1 parent 948104c commit e931a91

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
build:
13+
runs-on: macos-14 # Apple Silicon runner
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
cache: 'npm'
24+
25+
- name: Setup Rust
26+
uses: dtolnay/rust-action@stable
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Build Tauri app
32+
run: npm run tauri:build
33+
34+
- name: Get version from tag
35+
id: version
36+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
37+
38+
- name: Calculate DMG checksum
39+
id: checksum
40+
run: |
41+
DMG_PATH="src-tauri/target/release/bundle/dmg/anylinuxfs-gui_${{ steps.version.outputs.VERSION }}_aarch64.dmg"
42+
SHA256=$(shasum -a 256 "$DMG_PATH" | cut -d ' ' -f 1)
43+
echo "SHA256=$SHA256" >> $GITHUB_OUTPUT
44+
echo "DMG_PATH=$DMG_PATH" >> $GITHUB_OUTPUT
45+
46+
- name: Create GitHub Release
47+
uses: softprops/action-gh-release@v2
48+
with:
49+
files: ${{ steps.checksum.outputs.DMG_PATH }}
50+
generate_release_notes: true
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Update Homebrew cask
55+
if: success()
56+
env:
57+
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
58+
run: |
59+
if [ -z "$HOMEBREW_TAP_TOKEN" ]; then
60+
echo "HOMEBREW_TAP_TOKEN not set, skipping cask update"
61+
exit 0
62+
fi
63+
64+
VERSION="${{ steps.version.outputs.VERSION }}"
65+
SHA256="${{ steps.checksum.outputs.SHA256 }}"
66+
67+
# Clone homebrew-tap repo
68+
git clone https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/fenio/homebrew-tap.git
69+
cd homebrew-tap
70+
71+
# Update cask file
72+
cat > Casks/anylinuxfs-gui.rb << EOF
73+
cask "anylinuxfs-gui" do
74+
version "${VERSION}"
75+
sha256 "${SHA256}"
76+
77+
url "https://github.com/fenio/anylinuxfs-gui/releases/download/v#{version}/anylinuxfs-gui_#{version}_aarch64.dmg"
78+
name "anylinuxfs GUI"
79+
desc "macOS GUI for anylinuxfs - mount Linux filesystems on macOS"
80+
homepage "https://github.com/fenio/anylinuxfs-gui"
81+
82+
depends_on formula: "nohajc/anylinuxfs/anylinuxfs"
83+
depends_on arch: :arm64
84+
85+
app "anylinuxfs-gui.app"
86+
87+
zap trash: [
88+
"~/Library/Caches/com.anylinuxfs.gui",
89+
"~/Library/Preferences/com.anylinuxfs.gui.plist",
90+
]
91+
end
92+
EOF
93+
94+
# Commit and push
95+
git config user.name "github-actions[bot]"
96+
git config user.email "github-actions[bot]@users.noreply.github.com"
97+
git add Casks/anylinuxfs-gui.rb
98+
git commit -m "Update anylinuxfs-gui to v${VERSION}"
99+
git push

0 commit comments

Comments
 (0)