Skip to content

Commit 5d354c6

Browse files
committed
Build as zip
1 parent 9cccd31 commit 5d354c6

File tree

1 file changed

+58
-27
lines changed

1 file changed

+58
-27
lines changed

.github/workflows/build.yaml

Lines changed: 58 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- main
7-
- demo-mac-win
7+
- publish-demo-binaries
88
tags:
99
- "*"
1010
pull_request:
@@ -16,8 +16,11 @@ env:
1616
BUILD_TYPE: release
1717

1818
jobs:
19-
demo-linux:
19+
build-linux:
2020
runs-on: ubuntu-22.04
21+
strategy:
22+
matrix:
23+
demo: [false, true]
2124
steps:
2225
- name: Checkout repository
2326
uses: actions/checkout@v4
@@ -27,7 +30,8 @@ jobs:
2730
- name: Get latest tag version
2831
run: echo "PACKAGE_VERSION=$(git describe --tags --abbrev=0 || echo 0.0.0)" >> "$GITHUB_ENV"
2932

30-
- name: Patch
33+
- name: Apply patch
34+
if: matrix.demo == true
3135
run: |
3236
git diff origin/main..origin/demo > demo.patch
3337
git apply demo.patch
@@ -122,23 +126,33 @@ jobs:
122126
- name: Run linuxdeployqt
123127
run: |
124128
linuxdeployqt "AppDir/usr/share/applications/${APP_NAME}.desktop" -appimage -bundle-non-qt-libs
125-
mv ./*.AppImage "${APP_NAME}-${PACKAGE_VERSION}.AppImage"
126-
chmod +x "${APP_NAME}-${PACKAGE_VERSION}.AppImage"
129+
mv ./*.AppImage "${APP_NAME}-${PACKAGE_VERSION}${{ matrix.demo && '-demo' || '' }}.AppImage"
130+
chmod +x "${APP_NAME}-${PACKAGE_VERSION}${{ matrix.demo && '-demo' || '' }}.AppImage"
127131
128132
- name: Check AppImage
129133
run: |
130-
"./${APP_NAME}-${PACKAGE_VERSION}.AppImage" --appimage-extract
134+
"./${APP_NAME}-${PACKAGE_VERSION}${{ matrix.demo && '-demo' || '' }}.AppImage" --appimage-extract
131135
ldd "squashfs-root/usr/bin/${APP_NAME}"
132136
137+
- name: Zip builds
138+
if: matrix.demo == false
139+
run: |
140+
zip -P "${{ secrets.ZIP_PASSWORD }}" "${APP_NAME}-${PACKAGE_VERSION}.zip" "${APP_NAME}-${PACKAGE_VERSION}.AppImage"
141+
133142
- name: Upload artifacts
134143
uses: actions/upload-artifact@v4
135144
with:
136-
name: "${{ env.APP_NAME }}-artifacts-linux"
137-
path: "${{ env.APP_NAME }}-${{ env.PACKAGE_VERSION }}.AppImage"
145+
name: "${{ env.APP_NAME }}-artifacts-linux${{ matrix.demo && '-demo' || '' }}"
146+
path: |
147+
*.AppImage
148+
*.zip
138149
if-no-files-found: error
139150

140-
demo-mac:
151+
build-mac:
141152
runs-on: macos-latest
153+
strategy:
154+
matrix:
155+
demo: [false, true]
142156
steps:
143157
- name: Checkout repository
144158
uses: actions/checkout@v4
@@ -148,7 +162,8 @@ jobs:
148162
- name: Get latest tag version
149163
run: echo "PACKAGE_VERSION=$(git describe --tags --abbrev=0 || echo 0.0.0)" >> "$GITHUB_ENV"
150164

151-
- name: Patch
165+
- name: Apply patch
166+
if: matrix.demo == true
152167
run: |
153168
git diff origin/main..origin/demo > demo.patch
154169
git apply demo.patch
@@ -163,25 +178,32 @@ jobs:
163178
run: |
164179
mkdir -p build && cd build/
165180
qmake "../src/${{ env.APP_NAME }}.pro" CONFIG+="${{ env.BUILD_TYPE }}"
166-
make "-j$(nproc)"
181+
make "-j$(sysctl -n hw.ncpu)"
167182
168183
- name: Deploy
169-
run: macdeployqt "build/${{ env.APP_NAME }}.app" -dmg -verbose=2
184+
run: |
185+
macdeployqt "build/${{ env.APP_NAME }}.app" -dmg -verbose=2
186+
mv "build/${{ env.APP_NAME }}.dmg" "${{ env.APP_NAME }}-${{ env.PACKAGE_VERSION }}${{ matrix.demo && '-demo' || '' }}.dmg"
170187
171-
- run: |
172-
mv "build/${{ env.APP_NAME }}.dmg" "${{ env.APP_NAME }}-${{ env.PACKAGE_VERSION }}.dmg"
173-
ls -la
188+
- name: Zip builds
189+
if: matrix.demo == false
190+
run: |
191+
zip -P "${{ secrets.ZIP_PASSWORD }}" "${{ env.APP_NAME }}-${{ env.PACKAGE_VERSION }}.zip" "${{ env.APP_NAME }}-${{ env.PACKAGE_VERSION }}.dmg"
174192
175193
- name: Upload artifacts
176194
uses: actions/upload-artifact@v4
177195
with:
178-
name: "${{ env.APP_NAME }}-artifacts-mac"
179-
path: "${{ env.APP_LABEL }}-${{ env.PACKAGE_VERSION }}.dmg"
196+
name: "${{ env.APP_NAME }}-artifacts-mac${{ matrix.demo && '-demo' || '' }}"
197+
path: |
198+
*.dmg
199+
*.zip
180200
if-no-files-found: error
181201

182-
demo-windows:
202+
build-windows:
183203
runs-on: windows-latest
184-
204+
strategy:
205+
matrix:
206+
demo: [false, true]
185207
env:
186208
QT_DIR: ${{ github.workspace }}\Qt
187209

@@ -197,7 +219,8 @@ jobs:
197219
$tag = git describe --tags --abbrev=0
198220
echo "PACKAGE_VERSION=$tag" >> $env:GITHUB_ENV
199221
200-
- name: Patch
222+
- name: Apply patch
223+
if: matrix.demo == true
201224
run: |
202225
git diff origin/main..origin/demo > demo.patch
203226
git apply demo.patch
@@ -238,27 +261,35 @@ jobs:
238261
.\install.ps1 -RunAsAdmin
239262
scoop update
240263
scoop bucket add extras
241-
scoop install nsis
264+
scoop install nsis 7zip
242265
243266
- name: Print NSIS version
244267
run: makensis -VERSION
245268

246269
- name: Create NSIS installer
247270
run: |
248271
makensis /DAPP_NAME="${{ env.APP_NAME }}" /DPACKAGE_VERSION="${{ env.PACKAGE_VERSION }}" win-installer\installer.nsi
272+
REN "win-installer\${{ env.APP_NAME }}-${{ env.PACKAGE_VERSION }}.exe" "${{ env.APP_NAME }}-${{ env.PACKAGE_VERSION }}${{ matrix.demo && '-demo' || '' }}.exe"
273+
274+
- name: Zip builds
275+
if: matrix.demo == false
276+
run: |
277+
7z a -p"${{ secrets.ZIP_PASSWORD }}" -tzip "${{ env.APP_NAME }}-${{ env.PACKAGE_VERSION }}.zip" "${{ env.APP_NAME }}-${{ env.PACKAGE_VERSION }}.exe"
249278
250279
- name: Upload artifacts
251280
uses: actions/upload-artifact@v4
252281
with:
253-
name: "${{ env.APP_NAME }}-artifacts-win"
254-
path: "win-installer/${{ env.APP_NAME }}-${{ env.PACKAGE_VERSION }}.exe"
282+
name: "${{ env.APP_NAME }}-artifacts-win${{ matrix.demo && '-demo' || '' }}"
283+
path: |
284+
*.exe
285+
*.zip
255286
if-no-files-found: error
256287

257288
release:
258289
needs:
259-
- demo-linux
260-
- demo-mac
261-
- demo-windows
290+
- build-linux
291+
- build-mac
292+
- build-windows
262293
if: startsWith(github.ref, 'refs/tags/')
263294
runs-on: ubuntu-latest
264295

@@ -274,7 +305,7 @@ jobs:
274305
- name: Create GitHub Release
275306
uses: softprops/action-gh-release@v2
276307
with:
277-
files: artifacts/**/*.*
308+
files: artifacts/**/*-demo*
278309
tag_name: "${{ github.ref_name }}"
279310
name: "Release ${{ github.ref_name }}"
280311
body: "Automated release for version ${{ github.ref_name }}"

0 commit comments

Comments
 (0)