-
Notifications
You must be signed in to change notification settings - Fork 122
223 lines (191 loc) · 6.77 KB
/
Copy pathrelease.yml
File metadata and controls
223 lines (191 loc) · 6.77 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
args: --target aarch64-apple-darwin
target: aarch64-apple-darwin
- platform: macos-latest
args: --target x86_64-apple-darwin
target: x86_64-apple-darwin
- platform: ubuntu-22.04
args: ""
target: x86_64-unknown-linux-gnu
- platform: windows-latest
args: ""
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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 libasound2-dev
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: "./packages/app/src-tauri -> target"
- name: Install frontend dependencies
run: pnpm install
- name: Verify version consistency
run: node scripts/bump-version.js --check
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
VITE_FEEDBACK_WORKER_URL: ${{ secrets.FEEDBACK_WORKER_URL }}
with:
projectPath: "./packages/app"
tagName: ${{ github.ref_name }}
releaseName: "ReadAny ${{ github.ref_name }}"
releaseBody: "See ASSETS to download and install this version."
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
build-android:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Install dependencies
run: pnpm install
- name: Build reader assets
run: pnpm --filter @readany/app-expo run build:reader
- name: Setup Expo
uses: expo/expo-github-action@v8
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Build Android APK (Local)
env:
EXPO_PUBLIC_FEEDBACK_WORKER_URL: ${{ secrets.FEEDBACK_WORKER_URL }}
APP_VARIANT: production
run: |
VERSION=${GITHUB_REF_NAME#v}
cd packages/app-expo
npx eas-cli build --platform android --profile production-apk --local --non-interactive --output=../../ReadAny-${VERSION}.apk
- name: Upload to Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ReadAny-*.apk
tag_name: ${{ github.ref_name }}
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
create-updater-json:
needs: [build, build-android]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get version
id: version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Wait for release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Wait for release to be created
for i in {1..30}; do
if gh release view ${{ github.ref_name }} --json tagName --jq '.tagName' 2>/dev/null; then
echo "Release found"
break
fi
sleep 5
done
# Check if release is a draft
IS_DRAFT=$(gh release view ${{ github.ref_name }} --json isDraft --jq '.')
if [ "$IS_DRAFT" = "true" ]; then
echo "Release is a draft, skipping latest.json upload"
exit 0
fi
- name: Download signature files and generate latest.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.version }}"
REPO="${{ github.repository }}"
TAG="${{ github.ref_name }}"
# Download .sig files from the release (generated by tauri-action with TAURI_SIGNING_PRIVATE_KEY)
mkdir -p sigs
gh release download "$TAG" --pattern "*.sig" --dir sigs 2>/dev/null || true
# Read signatures (fallback to empty if sig file not found)
read_sig() {
local file="$1"
if [ -f "sigs/$file" ]; then
cat "sigs/$file"
else
echo ""
fi
}
SIG_DARWIN_AARCH64=$(read_sig "ReadAny_aarch64.app.tar.gz.sig")
SIG_DARWIN_X64=$(read_sig "ReadAny_x64.app.tar.gz.sig")
SIG_WINDOWS=$(read_sig "ReadAny_${VERSION}_x64-setup.exe.sig")
SIG_LINUX=$(read_sig "readany_${VERSION}_amd64.deb.sig")
cat > latest.json << EOF
{
"version": "${VERSION}",
"notes": "See https://github.com/${REPO}/releases/tag/${TAG} for details",
"pub_date": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
"platforms": {
"darwin-aarch64": {
"signature": "${SIG_DARWIN_AARCH64}",
"url": "https://github.com/${REPO}/releases/download/${TAG}/ReadAny_aarch64.app.tar.gz"
},
"darwin-x86_64": {
"signature": "${SIG_DARWIN_X64}",
"url": "https://github.com/${REPO}/releases/download/${TAG}/ReadAny_x64.app.tar.gz"
},
"windows-x86_64": {
"signature": "${SIG_WINDOWS}",
"url": "https://github.com/${REPO}/releases/download/${TAG}/ReadAny_${VERSION}_x64-setup.exe"
},
"linux-x86_64": {
"signature": "${SIG_LINUX}",
"url": "https://github.com/${REPO}/releases/download/${TAG}/readany_${VERSION}_amd64.deb"
}
}
}
EOF
- name: Upload latest.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.ref_name }} latest.json --clobber