-
Notifications
You must be signed in to change notification settings - Fork 0
230 lines (206 loc) Β· 7.72 KB
/
develop.yml
File metadata and controls
230 lines (206 loc) Β· 7.72 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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: π Develop
on:
push:
branches: [develop]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
name: π CI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run CI
uses: ./.github/actions/ci
with:
app: desktop
check-deploy:
name: π Check Deploy Marker
runs-on: ubuntu-latest
needs: ci
outputs:
should-deploy: ${{ steps.check.outputs.should-deploy }}
steps:
- name: Check deploy trigger
id: check
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "should-deploy=true" >> $GITHUB_OUTPUT
echo "β
Manual trigger (workflow_dispatch)"
else
COMMIT_MSG="${{ github.event.head_commit.message }}"
if [[ "$COMMIT_MSG" == *"#patch"* ]] || [[ "$COMMIT_MSG" == *"#deploy"* ]]; then
echo "should-deploy=true" >> $GITHUB_OUTPUT
echo "β
Deploy marker found in commit message"
else
echo "should-deploy=false" >> $GITHUB_OUTPUT
echo "βοΈ No deploy marker found, skipping deployment"
fi
fi
version-bump:
name: π¦ Version Bump
runs-on: ubuntu-latest
needs: check-deploy
if: needs.check-deploy.outputs.should-deploy == 'true'
outputs:
version: ${{ steps.bump.outputs.version }}
tag: ${{ steps.bump.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Bump version
id: bump
uses: ./.github/actions/version-bump
with:
app: desktop
app-directory: apps/desktop
build:
name: π¦ Build ${{ matrix.target }}
runs-on: ${{ matrix.platform }}
needs: version-bump
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
target: aarch64-apple-darwin
args: '--target aarch64-apple-darwin'
- platform: macos-latest
target: x86_64-apple-darwin
args: '--target x86_64-apple-darwin'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0
- name: Pull latest changes
run: git pull origin develop
- name: Build Tauri app
uses: ./.github/actions/build-tauri
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
app: desktop
app-directory: apps/desktop
platform: ${{ matrix.platform }}
target: ${{ matrix.target }}
args: ${{ matrix.args }}
config: prod
- name: Determine arch suffix
id: arch
shell: bash
run: |
if [[ "${{ matrix.target }}" == "aarch64-apple-darwin" ]]; then
echo "suffix=aarch64" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.target }}" == "x86_64-apple-darwin" ]]; then
echo "suffix=x64" >> $GITHUB_OUTPUT
else
echo "suffix=${{ matrix.target }}" >> $GITHUB_OUTPUT
fi
- name: Rename updater artifacts with arch suffix
shell: bash
run: |
BUNDLE_DIR="target/${{ matrix.target }}/release/bundle/macos"
if [ -f "$BUNDLE_DIR/Focuscat.app.tar.gz" ]; then
cp "$BUNDLE_DIR/Focuscat.app.tar.gz" "$BUNDLE_DIR/Focuscat_${{ steps.arch.outputs.suffix }}.app.tar.gz"
fi
if [ -f "$BUNDLE_DIR/Focuscat.app.tar.gz.sig" ]; then
cp "$BUNDLE_DIR/Focuscat.app.tar.gz.sig" "$BUNDLE_DIR/Focuscat_${{ steps.arch.outputs.suffix }}.app.tar.gz.sig"
fi
- name: Stage release files
shell: bash
run: |
mkdir -p release-bundle
cp target/${{ matrix.target }}/release/bundle/dmg/*.dmg release-bundle/
cp target/${{ matrix.target }}/release/bundle/macos/Focuscat_${{ steps.arch.outputs.suffix }}.app.tar.gz release-bundle/
cp target/${{ matrix.target }}/release/bundle/macos/Focuscat_${{ steps.arch.outputs.suffix }}.app.tar.gz.sig release-bundle/
- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ steps.arch.outputs.suffix }}
path: release-bundle/
upload-to-release:
name: π€ Upload to release
runs-on: ubuntu-latest
needs: [version-bump, build]
permissions:
contents: write
steps:
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
pattern: release-*
path: release-artifacts
merge-multiple: true
- name: Create release and upload assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.version-bump.outputs.tag }}
name: Focuscat v${{ needs.version-bump.outputs.version }}
body: |
## Focuscat v${{ needs.version-bump.outputs.version }}
${{ github.event_name == 'workflow_dispatch' && 'Manual release from Actions.' || 'Auto-deployed from develop branch.' }}
### Changes
${{ github.event_name == 'workflow_dispatch' && 'Triggered via workflow_dispatch.' || github.event.head_commit.message }}
draft: false
prerelease: true
files: release-artifacts/*
fail_on_unmatched_files: false
overwrite_files: true
updater-json:
name: π Generate Updater JSON
runs-on: ubuntu-latest
needs: [version-bump, upload-to-release]
permissions:
contents: write
steps:
- name: Generate latest.json
shell: bash
env:
VERSION: ${{ needs.version-bump.outputs.version }}
TAG: ${{ needs.version-bump.outputs.tag }}
run: |
REPO="builder-group/focuscat"
BASE_URL="https://github.com/${REPO}/releases/download/${TAG}"
# Download signature files from the release (retry up to 3 times with delay)
for arch in aarch64 x64; do
for attempt in 1 2 3; do
if curl -sfL "${BASE_URL}/Focuscat_${arch}.app.tar.gz.sig" -o "sig_${arch}.txt"; then
echo "β
Downloaded sig for ${arch}"
break
fi
echo "β³ Attempt ${attempt}/3 failed for ${arch} sig, retrying in 10s..."
sleep 10
done
done
SIG_AARCH64=$(cat sig_aarch64.txt 2>/dev/null || echo "")
SIG_X64=$(cat sig_x64.txt 2>/dev/null || echo "")
PUB_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
printf '{"version":"%s","pub_date":"%s","platforms":{"darwin-aarch64":{"signature":"%s","url":"%s"},"darwin-x86_64":{"signature":"%s","url":"%s"}}}' \
"${VERSION}" \
"${PUB_DATE}" \
"${SIG_AARCH64}" \
"${BASE_URL}/Focuscat_aarch64.app.tar.gz" \
"${SIG_X64}" \
"${BASE_URL}/Focuscat_x64.app.tar.gz" \
> latest.json
- name: Upload latest.json to release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.version-bump.outputs.tag }}
files: latest.json
fail_on_unmatched_files: false