-
Notifications
You must be signed in to change notification settings - Fork 26
218 lines (180 loc) · 6.13 KB
/
Publish.yml
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
name: "publish"
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
get-version:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
- name: Get version number
id: get_version
run: |
VERSION=$(jq -r '.version' src-tauri/tauri.conf.json)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
windows-build:
needs: get-version
env:
VERSION: ${{ needs.get-version.outputs.VERSION }}
outputs:
VERSION: ${{ env.VERSION }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Install frontend dependencies
run: pnpm install
- name: Build tauri app
uses: tauri-apps/tauri-action@v0
- name: Create artifacts directory
run: mkdir -p artifacts
- name: Copy nsis to release assets
run: cp src-tauri/target/release/bundle/nsis/jmcomic-downloader_${{ env.VERSION }}_x64-setup.exe artifacts/jmcomic-downloader_${{ env.VERSION }}_windows_x64.exe
- name: Zip portable to release assets
run: |
cd src-tauri/target/release
7z a -tzip ../../../artifacts/jmcomic-downloader_${{ env.VERSION }}_windows_x64_portable.zip jmcomic-downloader.exe
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: windows-assets
path: artifacts/*
linux-build:
needs: get-version
env:
VERSION: ${{ needs.get-version.outputs.VERSION }}
outputs:
VERSION: ${{ env.VERSION }}
runs-on: ubuntu-22.04
steps:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Install frontend dependencies
run: pnpm install
- name: Build tauri app
uses: tauri-apps/tauri-action@v0
- name: Create artifacts directory
run: mkdir -p artifacts
- name: Copy deb to release assets
run: cp src-tauri/target/release/bundle/deb/jmcomic-downloader_${{ env.VERSION }}_amd64.deb artifacts/jmcomic-downloader_${{ env.VERSION }}_linux_amd64.deb
- name: Copy rpm to release assets
run: cp src-tauri/target/release/bundle/rpm/jmcomic-downloader-${{ env.VERSION }}-1.x86_64.rpm artifacts/jmcomic-downloader_${{ env.VERSION }}_linux_amd64.rpm
- name: Zip portable to release assets
run: |
cd src-tauri/target/release
tar -czf ../../../artifacts/jmcomic-downloader_${{ env.VERSION }}_linux_amd64_portable.tar.gz jmcomic-downloader
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux-assets
path: artifacts/*
macos-build:
needs: get-version
env:
VERSION: ${{ needs.get-version.outputs.VERSION }}
outputs:
VERSION: ${{ env.VERSION }}
strategy:
fail-fast: false
matrix:
arch: [ aarch64, x86_64 ]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.arch }}-apple-darwin
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Install frontend dependencies
run: pnpm install
- name: Build tauri app
uses: tauri-apps/tauri-action@v0
with:
args: --target ${{ matrix.arch }}-apple-darwin
- name: Create artifacts directory
run: mkdir -p artifacts
- name: Copy dmg to release assets
env:
ARCH_ALIAS: ${{ matrix.arch == 'x86_64' && 'x64' || matrix.arch }}
run: cp src-tauri/target/${{ matrix.arch }}-apple-darwin/release/bundle/dmg/jmcomic-downloader_${{ env.VERSION }}_${{ env.ARCH_ALIAS }}.dmg artifacts/jmcomic-downloader_${{ env.VERSION }}_macos_${{ matrix.arch }}.dmg
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: macos-assets-${{ matrix.arch }}
path: artifacts/*
create-release:
needs: [ windows-build, linux-build, macos-build ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Windows assets
uses: actions/download-artifact@v4
with:
name: windows-assets
path: artifacts/windows
- name: Download Linux assets
uses: actions/download-artifact@v4
with:
name: linux-assets
path: artifacts/linux
- name: Download macOS aarch64 assets
uses: actions/download-artifact@v4
with:
name: macos-assets-aarch64
path: artifacts/macos-aarch64
- name: Download macOS x86_64 assets
uses: actions/download-artifact@v4
with:
name: macos-assets-x86_64
path: artifacts/macos-x86_64
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Desktop App v${{ needs.windows-build.outputs.VERSION }}
body: |
Take a look at the assets to download and install this app.
files: |
artifacts/windows/*
artifacts/linux/*
artifacts/macos-aarch64/*
artifacts/macos-x86_64/*
draft: true
prerelease: false