-
-
Notifications
You must be signed in to change notification settings - Fork 3
125 lines (98 loc) · 3.92 KB
/
Copy pathrelease.yml
File metadata and controls
125 lines (98 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: macos-14 # Apple Silicon runner
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: npm ci
- name: Build Tauri app
run: npm run tauri:build
- name: Get version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Ad-hoc sign and recreate DMG
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
APP_PATH="src-tauri/target/release/bundle/macos/anylinuxfs-gui.app"
DMG_PATH="src-tauri/target/release/bundle/dmg/anylinuxfs-gui_${VERSION}_aarch64.dmg"
# Sign the app
codesign --force --deep --sign - "$APP_PATH"
codesign --verify --verbose "$APP_PATH"
# Recreate DMG with signed app
rm -f "$DMG_PATH"
hdiutil create -volname "anylinuxfs-gui" -srcfolder "$APP_PATH" -ov -format UDZO "$DMG_PATH"
- name: Calculate DMG checksum
id: checksum
run: |
DMG_PATH="src-tauri/target/release/bundle/dmg/anylinuxfs-gui_${{ steps.version.outputs.VERSION }}_aarch64.dmg"
SHA256=$(shasum -a 256 "$DMG_PATH" | cut -d ' ' -f 1)
echo "SHA256=$SHA256" >> $GITHUB_OUTPUT
echo "DMG_PATH=$DMG_PATH" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.checksum.outputs.DMG_PATH }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Homebrew cask
if: success()
env:
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
if [ -z "$HOMEBREW_TAP_TOKEN" ]; then
echo "HOMEBREW_TAP_TOKEN not set, skipping cask update"
exit 0
fi
VERSION="${{ steps.version.outputs.VERSION }}"
SHA256="${{ steps.checksum.outputs.SHA256 }}"
git clone https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/fenio/homebrew-tap.git
cd homebrew-tap
cat > Casks/anylinuxfs-gui.rb << 'CASKEOF'
cask "anylinuxfs-gui" do
version "VERSION_PLACEHOLDER"
sha256 "SHA256_PLACEHOLDER"
url "https://github.com/fenio/anylinuxfs-gui/releases/download/v#{version}/anylinuxfs-gui_#{version}_aarch64.dmg"
name "anylinuxfs GUI"
desc "macOS GUI for anylinuxfs - mount Linux filesystems on macOS"
homepage "https://github.com/fenio/anylinuxfs-gui"
depends_on formula: "nohajc/anylinuxfs/anylinuxfs"
depends_on arch: :arm64
app "anylinuxfs-gui.app"
postflight do
system_command "/usr/bin/xattr",
args: ["-cr", "#{appdir}/anylinuxfs-gui.app"]
end
zap trash: [
"~/Library/Caches/com.anylinuxfs.gui",
"~/Library/Preferences/com.anylinuxfs.gui.plist",
]
end
CASKEOF
# Replace placeholders with actual values
sed -i '' "s/VERSION_PLACEHOLDER/${VERSION}/g" Casks/anylinuxfs-gui.rb
sed -i '' "s/SHA256_PLACEHOLDER/${SHA256}/g" Casks/anylinuxfs-gui.rb
# Fix indentation (remove leading spaces from heredoc)
sed -i '' 's/^ //' Casks/anylinuxfs-gui.rb
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Casks/anylinuxfs-gui.rb
git commit -m "Update anylinuxfs-gui to v${VERSION}"
git push