1+ name : " publish"
2+
3+ on :
4+ push :
5+ tags :
6+ - " v*"
7+
8+ env :
9+ REPO_NAME : hitomi-downloader
10+
11+ jobs :
12+ get-version :
13+ runs-on : ubuntu-latest
14+ outputs :
15+ VERSION : ${{ steps.get_version.outputs.VERSION }}
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - name : Get version number
20+ id : get_version
21+ run : |
22+ VERSION=$(jq -r '.version' src-tauri/tauri.conf.json)
23+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
24+
25+ windows-build :
26+ needs : get-version
27+ env :
28+ VERSION : ${{ needs.get-version.outputs.VERSION }}
29+ outputs :
30+ VERSION : ${{ env.VERSION }}
31+ runs-on : windows-latest
32+ steps :
33+ - uses : actions/checkout@v4
34+
35+ - name : Setup node
36+ uses : actions/setup-node@v4
37+ with :
38+ node-version : lts/*
39+
40+ - name : Install Rust stable
41+ uses : dtolnay/rust-toolchain@stable
42+
43+ - name : Install pnpm
44+ uses : pnpm/action-setup@v4
45+ with :
46+ run_install : false
47+
48+ - name : Install frontend dependencies
49+ run : pnpm install
50+
51+ - name : Build tauri app
52+ uses : tauri-apps/tauri-action@v0
53+
54+ - name : Create artifacts directory
55+ run : mkdir -p artifacts
56+
57+ - name : Copy nsis to release assets
58+ run : cp src-tauri/target/release/bundle/nsis/${{ env.REPO_NAME }}_${{ env.VERSION }}_x64-setup.exe artifacts/${{ env.REPO_NAME }}_${{ env.VERSION }}_windows_x64.exe
59+
60+ - name : Zip portable to release assets
61+ run : |
62+ cd src-tauri/target/release
63+ 7z a -tzip ../../../artifacts/${{ env.REPO_NAME }}_${{ env.VERSION }}_windows_x64_portable.zip ${{ env.REPO_NAME }}.exe
64+
65+ - name : Upload artifacts
66+ uses : actions/upload-artifact@v4
67+ with :
68+ name : windows-assets
69+ path : artifacts/*
70+
71+ linux-build :
72+ needs : get-version
73+ env :
74+ VERSION : ${{ needs.get-version.outputs.VERSION }}
75+ outputs :
76+ VERSION : ${{ env.VERSION }}
77+ runs-on : ubuntu-24.04
78+ steps :
79+ - name : install dependencies
80+ run : |
81+ sudo apt-get update
82+ sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
83+ - uses : actions/checkout@v4
84+
85+ - name : Setup node
86+ uses : actions/setup-node@v4
87+ with :
88+ node-version : lts/*
89+
90+ - name : Install Rust stable
91+ uses : dtolnay/rust-toolchain@stable
92+
93+ - name : Install pnpm
94+ uses : pnpm/action-setup@v4
95+ with :
96+ run_install : false
97+
98+ - name : Install frontend dependencies
99+ run : pnpm install
100+
101+ - name : Build tauri app
102+ uses : tauri-apps/tauri-action@v0
103+
104+ - name : Create artifacts directory
105+ run : mkdir -p artifacts
106+
107+ - name : Copy deb to release assets
108+ run : cp src-tauri/target/release/bundle/deb/${{ env.REPO_NAME }}_${{ env.VERSION }}_amd64.deb artifacts/${{ env.REPO_NAME }}_${{ env.VERSION }}_linux_amd64.deb
109+
110+ - name : Copy rpm to release assets
111+ run : cp src-tauri/target/release/bundle/rpm/${{ env.REPO_NAME }}-${{ env.VERSION }}-1.x86_64.rpm artifacts/${{ env.REPO_NAME }}_${{ env.VERSION }}_linux_amd64.rpm
112+
113+ - name : Zip portable to release assets
114+ run : |
115+ cd src-tauri/target/release
116+ tar -czf ../../../artifacts/${{ env.REPO_NAME }}_${{ env.VERSION }}_linux_amd64_portable.tar.gz ${{ env.REPO_NAME }}
117+
118+ - name : Upload artifacts
119+ uses : actions/upload-artifact@v4
120+ with :
121+ name : linux-assets
122+ path : artifacts/*
123+
124+ macos-build :
125+ needs : get-version
126+ env :
127+ VERSION : ${{ needs.get-version.outputs.VERSION }}
128+ outputs :
129+ VERSION : ${{ env.VERSION }}
130+ strategy :
131+ fail-fast : false
132+ matrix :
133+ arch : [ aarch64, x86_64 ]
134+ runs-on : macos-latest
135+ steps :
136+ - uses : actions/checkout@v4
137+
138+ - name : Setup node
139+ uses : actions/setup-node@v4
140+ with :
141+ node-version : lts/*
142+
143+ - name : Install Rust stable
144+ uses : dtolnay/rust-toolchain@stable
145+ with :
146+ targets : ${{ matrix.arch }}-apple-darwin
147+
148+ - name : Install pnpm
149+ uses : pnpm/action-setup@v4
150+ with :
151+ run_install : false
152+
153+ - name : Install frontend dependencies
154+ run : pnpm install
155+
156+ - name : Build tauri app
157+ uses : tauri-apps/tauri-action@v0
158+ with :
159+ args : --target ${{ matrix.arch }}-apple-darwin
160+
161+ - name : Create artifacts directory
162+ run : mkdir -p artifacts
163+
164+ - name : Copy dmg to release assets
165+ env :
166+ ARCH_ALIAS : ${{ matrix.arch == 'x86_64' && 'x64' || matrix.arch }}
167+ run : cp src-tauri/target/${{ matrix.arch }}-apple-darwin/release/bundle/dmg/${{ env.REPO_NAME }}_${{ env.VERSION }}_${{ env.ARCH_ALIAS }}.dmg artifacts/${{ env.REPO_NAME }}_${{ env.VERSION }}_macos_${{ matrix.arch }}.dmg
168+
169+ - name : Upload artifacts
170+ uses : actions/upload-artifact@v4
171+ with :
172+ name : macos-assets-${{ matrix.arch }}
173+ path : artifacts/*
174+
175+ create-release :
176+ needs : [ windows-build, linux-build, macos-build ]
177+ runs-on : ubuntu-latest
178+ permissions :
179+ contents : write
180+ steps :
181+ - name : Download Windows assets
182+ uses : actions/download-artifact@v4
183+ with :
184+ name : windows-assets
185+ path : artifacts/windows
186+
187+ - name : Download Linux assets
188+ uses : actions/download-artifact@v4
189+ with :
190+ name : linux-assets
191+ path : artifacts/linux
192+
193+ - name : Download macOS aarch64 assets
194+ uses : actions/download-artifact@v4
195+ with :
196+ name : macos-assets-aarch64
197+ path : artifacts/macos-aarch64
198+
199+ - name : Download macOS x86_64 assets
200+ uses : actions/download-artifact@v4
201+ with :
202+ name : macos-assets-x86_64
203+ path : artifacts/macos-x86_64
204+
205+ - name : List files in artifacts directory
206+ run : ls -R artifacts
207+
208+ - name : Create GitHub Release
209+ id : create_release
210+ uses : softprops/action-gh-release@v2
211+ env :
212+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
213+ with :
214+ name : Desktop App v${{ needs.windows-build.outputs.VERSION }}
215+ body : |
216+ Take a look at the assets to download and install this app.
217+ files : |
218+ artifacts/windows/*
219+ artifacts/linux/*
220+ artifacts/macos-aarch64/*
221+ artifacts/macos-x86_64/*
222+ draft : true
223+ prerelease : false
0 commit comments