-
Notifications
You must be signed in to change notification settings - Fork 0
205 lines (172 loc) · 6.55 KB
/
release.yml
File metadata and controls
205 lines (172 loc) · 6.55 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build-cli-windows:
runs-on: windows-latest
env:
DEFINE_API_URL: "process.env.SYNC_GAMES_API_URL='${{ secrets.SYNC_GAMES_API_URL }}'"
DEFINE_API_KEY: "process.env.SYNC_GAMES_API_KEY='${{ secrets.SYNC_GAMES_API_KEY }}'"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Sync version from tag
run: bun run scripts/sync-version.ts
env:
GITHUB_REF: ${{ github.ref }}
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build CLI (Windows x64)
run: |
New-Item -ItemType Directory -Force -Path dist
bun build apps/cli/index.ts --compile --outfile dist/savecloud-windows-x64.exe --define $env:DEFINE_API_URL --define $env:DEFINE_API_KEY --minify --windows-icon assets/icon.ico
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cli-windows
path: dist/savecloud-windows-x64.exe
build-cli-unix:
runs-on: ubuntu-latest
env:
DEFINE_API_URL: "process.env.SYNC_GAMES_API_URL='${{ secrets.SYNC_GAMES_API_URL }}'"
DEFINE_API_KEY: "process.env.SYNC_GAMES_API_KEY='${{ secrets.SYNC_GAMES_API_KEY }}'"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Sync version from tag
run: bun run scripts/sync-version.ts
env:
GITHUB_REF: ${{ github.ref }}
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build CLI (Linux x64)
run: |
mkdir -p dist
bun build apps/cli/index.ts --compile --target=bun-linux-x64 --outfile dist/savecloud-linux-x64 \
--define "$DEFINE_API_URL" --define "$DEFINE_API_KEY" --minify
- name: Build CLI (macOS arm64)
run: |
bun build apps/cli/index.ts --compile --target=bun-darwin-arm64 --outfile dist/savecloud-darwin-arm64 \
--define "$DEFINE_API_URL" --define "$DEFINE_API_KEY" --minify
- name: Build CLI (macOS x64)
run: |
bun build apps/cli/index.ts --compile --target=bun-darwin-x64 --outfile dist/savecloud-darwin-x64 \
--define "$DEFINE_API_URL" --define "$DEFINE_API_KEY" --minify
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cli-unix
path: |
dist/savecloud-linux-x64
dist/savecloud-darwin-arm64
dist/savecloud-darwin-x64
build-desktop:
strategy:
fail-fast: false
matrix:
include:
- platform: windows-latest
artifactName: desktop-windows
args: ""
- platform: ubuntu-22.04
artifactName: desktop-linux
args: ""
- platform: macos-latest
artifactName: desktop-macos-universal
args: "--target universal-apple-darwin"
rustTargets: "aarch64-apple-darwin x86_64-apple-darwin"
runs-on: ${{ matrix.platform }}
env:
SYNC_GAMES_API_URL: ${{ secrets.SYNC_GAMES_API_URL }}
SYNC_GAMES_API_KEY: ${{ secrets.SYNC_GAMES_API_KEY }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rustTargets || '' }}
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "apps/desktop/src-tauri -> target"
- name: Sync version from tag
run: bun run scripts/sync-version.ts
env:
GITHUB_REF: ${{ github.ref }}
# Build deps on Ubuntu; runtime deps for installers live in tauri.conf.json:
# bundle.linux.deb.depends (apt/dpkg), bundle.linux.rpm.depends (dnf/rpm).
# AUR / pacman: no .deb/.rpm metadata — mirror the same libs in PKGBUILD depends (see those lists).
- name: Install dependencies (Ubuntu)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libasound2-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libudev-dev build-essential curl wget file libxdo-dev libssl-dev
- name: Install dependencies
run: bun install --frozen-lockfile
working-directory: apps/desktop
- name: NSIS branding (Windows)
if: matrix.platform == 'windows-latest'
run: bun run nsis-branding
working-directory: apps/desktop
- name: Build Tauri
run: bun run tauri build ${{ matrix.args }}
working-directory: apps/desktop
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifactName }}
path: apps/desktop/src-tauri/target/**/release/bundle/
release:
needs: [build-cli-windows, build-cli-unix, build-desktop]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Consolidate release files
run: |
mkdir -p release
find cli-windows -type f -exec cp {} release/ \;
find cli-unix -type f -exec cp {} release/ \;
for dir in desktop-*; do
[ -d "$dir" ] && find "$dir" -type f \( -name "*.msi" -o -name "*.exe" -o -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" -o -name "*.dmg" -o -name "*.sig" -o -name "*.app.tar.gz" -o -name "*.tar.gz" -o -name "*.zip" \) -exec cp {} release/ \;
done
- name: Generate updater latest.json
run: bun run scripts/generate-updater-json.ts
env:
GITHUB_REF: ${{ github.ref }}
GITHUB_REPOSITORY: ${{ github.repository }}
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}