-
Notifications
You must be signed in to change notification settings - Fork 0
216 lines (187 loc) · 6.43 KB
/
release.yaml
File metadata and controls
216 lines (187 loc) · 6.43 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Publish GitHub Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
label: macos
build_cmd: npx electron-builder --mac dmg zip --x64 --arm64 --publish=never
artifact_glob: |
dist/*.dmg
dist/*.dmg.blockmap
dist/*.zip
dist/latest-mac.yml
- os: windows-latest
label: windows
build_cmd: npx electron-builder --win nsis --x64 --publish=never
artifact_glob: |
dist/*.exe
dist/*.exe.blockmap
dist/latest.yml
- os: ubuntu-latest
label: linux
build_cmd: npx electron-builder --linux AppImage --x64 --publish=never
artifact_glob: |
dist/*.AppImage
dist/*.AppImage.zsync
dist/latest-linux.yml
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate tag matches app version
shell: bash
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PKG_VERSION=$(node -p "require('./package.json').version")
echo "Tag version: ${TAG_VERSION}"
echo "package.json version: ${PKG_VERSION}"
if [[ "${TAG_VERSION}" != "${PKG_VERSION}" ]]; then
echo "❌ Tag (${GITHUB_REF_NAME}) does not match package.json version (${PKG_VERSION})."
echo " Bump package.json version first, then tag that exact version."
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: |
package-lock.json
frontend/package-lock.json
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libnotify-dev \
libnss3 \
libxss1 \
libasound2t64 \
libxtst6 \
fuse3 \
xauth \
xvfb
sudo apt-get install -y libfuse2 || sudo apt-get install -y libfuse2t64 || true
- name: Install root dependencies
run: npm install --include=dev --ignore-scripts
- name: Install frontend dependencies
run: npm install --prefix frontend --ignore-scripts
- name: Prepare bundled media binaries
run: npm run prepare-binaries
- name: Build frontend
run: |
echo "VITE_APP_VERSION=$(node -p "require('./package.json').version")" >> "$GITHUB_ENV"
npm run build --prefix frontend
- name: Ensure app-builder executable permission (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
chmod +x node_modules/app-builder-bin/linux/x64/app-builder || true
chmod +x node_modules/app-builder-bin/linux/arm64/app-builder || true
- name: Build Electron installers (macOS/Windows)
if: matrix.os != 'ubuntu-latest'
run: ${{ matrix.build_cmd }}
- name: Build Electron installers (Linux retry)
if: matrix.os == 'ubuntu-latest'
run: |
set -e
for attempt in 1 2 3; do
echo "Linux AppImage build attempt ${attempt}/3"
if npx electron-builder --linux AppImage --x64 --publish=never; then
exit 0
fi
if [ "$attempt" -lt 3 ]; then
echo "Transient AppImage tool download failure, retrying in 15s..."
sleep 15
fi
done
echo "Linux AppImage build failed after 3 attempts"
exit 1
- name: Upload installers
uses: actions/upload-artifact@v4
with:
name: aether-${{ matrix.label }}-installers
path: ${{ matrix.artifact_glob }}
if-no-files-found: error
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download macOS installers
uses: actions/download-artifact@v4
with:
name: aether-macos-installers
path: release-assets/macos
- name: Download Windows installers
uses: actions/download-artifact@v4
with:
name: aether-windows-installers
path: release-assets/windows
- name: Download Linux installers
uses: actions/download-artifact@v4
with:
name: aether-linux-installers
path: release-assets/linux
- name: Generate checksums manifest
run: |
mkdir -p release-assets/meta
find release-assets -type f \
! -name '*.blockmap' \
! -path 'release-assets/meta/*' \
-print0 | sort -z | xargs -0 shasum -a 256 > release-assets/meta/SHA256SUMS.txt
- name: Generate Homebrew cask file
run: |
node scripts/generate-homebrew-cask.cjs \
--repo "${{ github.repository }}" \
--tag "${{ github.ref_name }}" \
--dmg-dir "release-assets/macos" \
--out "release-assets/homebrew/Casks/aether.rb"
- name: Push Homebrew cask to tap
if: vars.HOMEBREW_TAP_REPO != ''
env:
HOMEBREW_TAP_REPO: ${{ vars.HOMEBREW_TAP_REPO }}
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
if [ -z "${HOMEBREW_TAP_TOKEN}" ]; then
echo "HOMEBREW_TAP_TOKEN is not set. Skipping..."
exit 0
fi
set -euo pipefail
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
TAP_DIR="$(mktemp -d)"
git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/${HOMEBREW_TAP_REPO}.git" "${TAP_DIR}"
mkdir -p "${TAP_DIR}/Casks"
cp release-assets/homebrew/Casks/aether.rb "${TAP_DIR}/Casks/aether.rb"
cd "${TAP_DIR}"
if git diff --quiet -- Casks/aether.rb; then
echo "Homebrew cask already up to date."
exit 0
fi
git add Casks/aether.rb
git commit -m "Update Aether cask to ${GITHUB_REF_NAME}"
git push origin HEAD
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
release-assets/macos/*
release-assets/windows/*
release-assets/linux/*
release-assets/meta/SHA256SUMS.txt
release-assets/homebrew/Casks/aether.rb
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}