-
Notifications
You must be signed in to change notification settings - Fork 16
198 lines (168 loc) · 6.09 KB
/
Copy pathbuild-release.yml
File metadata and controls
198 lines (168 loc) · 6.09 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
name: Build and Release
on:
push:
branches:
- main
- dev
permissions:
contents: write
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
release_id: ${{ steps.create_release.outputs.id }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version from tauri.conf.json
id: get_version
run: |
VERSION=$(jq -r '.version' src-tauri/tauri.conf.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create draft release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.get_version.outputs.version }}
name: ZeroLimit v${{ steps.get_version.outputs.version }}
draft: true
generate_release_notes: true
build-windows-x64:
needs: create-release
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-x64-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-x64-
- name: Install frontend dependencies
run: pnpm install
- name: Build Tauri (x64)
run: pnpm tauri build --target x86_64-pc-windows-msvc
- name: Prepare portable executable
run: |
VERSION="${{ needs.create-release.outputs.version }}"
cp src-tauri/target/x86_64-pc-windows-msvc/release/ZeroLimit.exe "ZeroLimit_${VERSION}_portable.exe"
- name: Upload artifacts to release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.create-release.outputs.version }}
draft: true
files: |
src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe
src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe.sig
src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/*.msi
src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/*.msi.sig
ZeroLimit_*_portable.exe
build-windows-arm64:
needs: create-release
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-pc-windows-msvc
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-arm64-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-arm64-
- name: Install frontend dependencies
run: pnpm install
- name: Build Tauri (ARM64)
run: pnpm tauri build --target aarch64-pc-windows-msvc
- name: Prepare portable executable
run: |
VERSION="${{ needs.create-release.outputs.version }}"
cp src-tauri/target/aarch64-pc-windows-msvc/release/ZeroLimit.exe "ZeroLimit_${VERSION}_arm64_portable.exe"
- name: Upload artifacts to release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.create-release.outputs.version }}
draft: true
files: |
src-tauri/target/aarch64-pc-windows-msvc/release/bundle/nsis/*.exe
src-tauri/target/aarch64-pc-windows-msvc/release/bundle/nsis/*.exe.sig
src-tauri/target/aarch64-pc-windows-msvc/release/bundle/msi/*.msi
src-tauri/target/aarch64-pc-windows-msvc/release/bundle/msi/*.msi.sig
ZeroLimit_*_portable.exe
publish-release:
needs: [create-release, build-windows-x64, build-windows-arm64]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download release assets
uses: robinraju/release-downloader@v1
with:
tag: v${{ needs.create-release.outputs.version }}
fileName: "*.sig"
out-file-path: signatures
- name: Generate latest.json
run: |
VERSION="${{ needs.create-release.outputs.version }}"
REPO="${{ github.repository }}"
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
# Read signature files
X64_SIG=$(cat signatures/*x64*.exe.sig 2>/dev/null || echo "")
ARM64_SIG=$(cat signatures/*arm64*.exe.sig 2>/dev/null || echo "")
cat > latest.json << EOF
{
"version": "$VERSION",
"notes": "See release notes on GitHub",
"pub_date": "$DATE",
"platforms": {
"windows-x86_64": {
"signature": "$X64_SIG",
"url": "https://github.com/$REPO/releases/download/v$VERSION/ZeroLimit_${VERSION}_x64-setup.exe"
},
"windows-aarch64": {
"signature": "$ARM64_SIG",
"url": "https://github.com/$REPO/releases/download/v$VERSION/ZeroLimit_${VERSION}_arm64-setup.exe"
}
}
}
EOF
- name: Upload latest.json
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.create-release.outputs.version }}
draft: false
files: latest.json