-
Notifications
You must be signed in to change notification settings - Fork 0
235 lines (205 loc) · 8.9 KB
/
release.yml
File metadata and controls
235 lines (205 loc) · 8.9 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
231
232
233
234
235
name: Release Build
on:
push:
branches:
- release
jobs:
release:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest'
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04'
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Install dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: yarn install
- name: Get version from package.json
id: version
shell: bash
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Check signing configuration
shell: bash
run: |
if [ -n "${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}" ]; then
echo "✓ TAURI_SIGNING_PRIVATE_KEY is set (length: ${#TAURI_SIGNING_PRIVATE_KEY})"
else
echo "✗ TAURI_SIGNING_PRIVATE_KEY is NOT set"
fi
if [ -n "${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}" ]; then
echo "✓ TAURI_SIGNING_PRIVATE_KEY_PASSWORD is set"
else
echo "✗ TAURI_SIGNING_PRIVATE_KEY_PASSWORD is NOT set"
fi
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
- name: Extract changelog for this version
id: changelog
shell: bash
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
# Extract the section for this version from CHANGELOG.md
# Finds content between ## [VERSION] and the next ## [
CHANGELOG=$(awk "/## \[${VERSION}\]/{flag=1; next} /## \[/{flag=0} flag" CHANGELOG.md)
# Output to GitHub Actions in multiline format
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "Extracted changelog:"
echo "$CHANGELOG"
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
PUBLIC_SUPABASE_URL: ${{ secrets.PUBLIC_SUPABASE_URL }}
PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.PUBLIC_SUPABASE_ANON_KEY }}
PUBLIC_SENTRY_DSN: ${{ secrets.PUBLIC_SENTRY_DSN }}
with:
tagName: v${{ steps.version.outputs.VERSION }}
releaseName: 'Dota Keeper v${{ steps.version.outputs.VERSION }}'
releaseBody: ${{ steps.changelog.outputs.CHANGELOG }}
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
- name: Verify signature files were created
shell: bash
run: |
echo "Checking for .sig files in target directory..."
find src-tauri/target -name "*.sig" -type f || echo "No .sig files found"
echo ""
echo "Listing all files in bundle directories:"
find src-tauri/target -type d -name "bundle" -exec sh -c 'echo "=== {} ==="; ls -la "{}" 2>/dev/null || true' \;
echo ""
echo "Searching for any signature-related files:"
find src-tauri/target -type f \( -name "*.sig" -o -name "*signature*" \) 2>/dev/null || echo "No signature files found"
- name: List all release assets
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Listing all assets in the draft release..."
gh release view "v${{ steps.version.outputs.VERSION }}" --json assets --jq '.assets[].name' || echo "Could not list release assets"
update-release-json:
needs: release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: release
- name: Get version from package.json
id: version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Download and inspect release signatures
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
echo "=== Release assets for v${VERSION} ==="
gh release view "v${VERSION}" --json assets --jq '.assets[].name' || echo "Could not list assets"
mkdir -p ./signatures
# Download all .sig files
echo ""
echo "=== Downloading .sig files ==="
gh release download "v${VERSION}" --pattern "*.sig" --dir ./signatures 2>&1 || \
echo "Warning: gh release download failed or no .sig files found"
echo ""
echo "=== Downloaded signature files ==="
ls -la ./signatures/ 2>/dev/null || echo "No files downloaded"
- name: Update latest.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
PUB_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
WIN_SIG=""
LINUX_SIG=""
MACOS_X64_SIG=""
MACOS_ARM_SIG=""
# Classify each downloaded .sig file by its name.
# Order matters: aarch64 before x64, amd64 before x64, .app.tar.gz before plain x64.
for f in ./signatures/*.sig; do
[ -f "$f" ] || continue
name=$(basename "$f")
echo "Classifying: $name"
case "$name" in
*aarch64*) MACOS_ARM_SIG=$(cat "$f"); echo " → macOS ARM" ;;
*amd64*) LINUX_SIG=$(cat "$f"); echo " → Linux x64" ;;
*x64.app.tar.gz.sig) MACOS_X64_SIG=$(cat "$f"); echo " → macOS x64" ;;
*x64*) WIN_SIG=$(cat "$f"); echo " → Windows x64" ;;
*) echo " → unrecognised, skipping" ;;
esac
done
echo ""
echo "Windows sig present: $([ -n "$WIN_SIG" ] && echo yes || echo NO)"
echo "Linux sig present: $([ -n "$LINUX_SIG" ] && echo yes || echo NO)"
echo "macOS x64 sig present: $([ -n "$MACOS_X64_SIG" ] && echo yes || echo NO)"
echo "macOS ARM sig present: $([ -n "$MACOS_ARM_SIG" ] && echo yes || echo NO)"
mkdir -p meta/autoupdate
cat > meta/autoupdate/latest.json << EOF
{
"version": "${VERSION}",
"notes": "Release v${VERSION}",
"pub_date": "${PUB_DATE}",
"platforms": {
"windows-x86_64": {
"signature": "${WIN_SIG}",
"url": "https://github.com/stringhandler/dota-keeper/releases/download/v${VERSION}/Dota.Keeper_${VERSION}_x64_en-US.msi"
},
"linux-x86_64": {
"signature": "${LINUX_SIG}",
"url": "https://github.com/stringhandler/dota-keeper/releases/download/v${VERSION}/Dota.Keeper_${VERSION}_amd64.AppImage.tar.gz"
},
"darwin-x86_64": {
"signature": "${MACOS_X64_SIG}",
"url": "https://github.com/stringhandler/dota-keeper/releases/download/v${VERSION}/Dota.Keeper_x64.app.tar.gz"
},
"darwin-aarch64": {
"signature": "${MACOS_ARM_SIG}",
"url": "https://github.com/stringhandler/dota-keeper/releases/download/v${VERSION}/Dota.Keeper_aarch64.app.tar.gz"
}
}
}
EOF
echo ""
echo "=== Generated latest.json ==="
cat meta/autoupdate/latest.json
- name: Commit latest.json to repo
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add meta/autoupdate/latest.json
git diff --cached --quiet || git commit -m "chore: update latest.json for v${{ steps.version.outputs.VERSION }}"
git push
- name: Upload latest.json to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
gh release upload "v${VERSION}" meta/autoupdate/latest.json --clobber