11name : Build and Release
22
3+ # Triggers:
4+ # - Release published with tags:
5+ # - server-v* : Build only Server
6+ # - app-v* : Build only TFMAudioApp (Android, Windows, macOS)
7+ # - v* : Build everything
8+ # - Manual workflow dispatch with checkboxes
9+
310on :
411 release :
512 types : [published]
13+ workflow_dispatch :
14+ inputs :
15+ build_server :
16+ description : ' Build Server'
17+ type : boolean
18+ default : false
19+ build_android :
20+ description : ' Build Android App'
21+ type : boolean
22+ default : false
23+ build_windows :
24+ description : ' Build Windows App'
25+ type : boolean
26+ default : false
27+ build_macos :
28+ description : ' Build macOS App'
29+ type : boolean
30+ default : false
31+ version :
32+ description : ' Version (e.g., 1.0.0)'
33+ type : string
34+ required : false
35+ default : ' 0.0.0-manual'
636
737permissions :
838 contents : write
1949 build-server :
2050 name : Build Server
2151 runs-on : ubuntu-latest
52+ # Run if: manual with build_server OR release with server-v* or v* (but not app-v*)
53+ if : |
54+ (github.event_name == 'workflow_dispatch' && inputs.build_server) ||
55+ (github.event_name == 'release' && (startsWith(github.event.release.tag_name, 'server-v') || (startsWith(github.event.release.tag_name, 'v') && !startsWith(github.event.release.tag_name, 'app-v'))))
2256 steps :
2357 - name : ' 📄 Checkout'
2458 uses : actions/checkout@v4
3872 - name : ' 📦 Extract version'
3973 id : version
4074 run : |
41- TAG=${{ github.event.release.tag_name }}
42- VERSION=${TAG#v}
75+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
76+ VERSION="${{ inputs.version }}"
77+ TAG="v${VERSION}"
78+ else
79+ TAG=${{ github.event.release.tag_name }}
80+ # Remove server-v or v prefix
81+ VERSION=${TAG#server-v}
82+ VERSION=${VERSION#v}
83+ fi
4384 echo "version=$VERSION" >> $GITHUB_OUTPUT
4485 echo "tag=$TAG" >> $GITHUB_OUTPUT
4586
@@ -85,6 +126,10 @@ jobs:
85126 build-android :
86127 name : Build Android APK
87128 runs-on : ubuntu-latest
129+ # Run if: manual with build_android OR release with app-v* or v* (but not server-v*)
130+ if : |
131+ (github.event_name == 'workflow_dispatch' && inputs.build_android) ||
132+ (github.event_name == 'release' && (startsWith(github.event.release.tag_name, 'app-v') || (startsWith(github.event.release.tag_name, 'v') && !startsWith(github.event.release.tag_name, 'server-v'))))
88133 steps :
89134 - name : ' 📄 Checkout'
90135 uses : actions/checkout@v4
@@ -109,8 +154,15 @@ jobs:
109154 - name : ' 📦 Extract version'
110155 id : version
111156 run : |
112- TAG=${{ github.event.release.tag_name }}
113- VERSION=${TAG#v}
157+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
158+ VERSION="${{ inputs.version }}"
159+ TAG="v${VERSION}"
160+ else
161+ TAG=${{ github.event.release.tag_name }}
162+ # Remove app-v or v prefix
163+ VERSION=${TAG#app-v}
164+ VERSION=${VERSION#v}
165+ fi
114166 # Extract version number for Android (must be integer)
115167 VERSION_CODE=$(echo $VERSION | sed 's/\.//g' | sed 's/[^0-9]//g')
116168 # If empty or starts with 0, use date-based version
@@ -195,6 +247,10 @@ jobs:
195247 build-windows :
196248 name : Build Windows App
197249 runs-on : windows-2022
250+ # Run if: manual with build_windows OR release with app-v* or v* (but not server-v*)
251+ if : |
252+ (github.event_name == 'workflow_dispatch' && inputs.build_windows) ||
253+ (github.event_name == 'release' && (startsWith(github.event.release.tag_name, 'app-v') || (startsWith(github.event.release.tag_name, 'v') && !startsWith(github.event.release.tag_name, 'server-v'))))
198254 steps :
199255 - name : ' 📄 Checkout'
200256 uses : actions/checkout@v4
@@ -220,8 +276,15 @@ jobs:
220276 id : version
221277 shell : bash
222278 run : |
223- TAG=${{ github.event.release.tag_name }}
224- VERSION=${TAG#v}
279+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
280+ VERSION="${{ inputs.version }}"
281+ TAG="v${VERSION}"
282+ else
283+ TAG=${{ github.event.release.tag_name }}
284+ # Remove app-v or v prefix
285+ VERSION=${TAG#app-v}
286+ VERSION=${VERSION#v}
287+ fi
225288 echo "version=$VERSION" >> $GITHUB_OUTPUT
226289 echo "tag=$TAG" >> $GITHUB_OUTPUT
227290
@@ -239,6 +302,7 @@ jobs:
239302 -o bin/windows-app
240303
241304 - name : ' 🔐 Sign Windows App (if certificate available)'
305+ continue-on-error : true
242306 shell : pwsh
243307 env :
244308 WINDOWS_CERT_BASE64 : ${{ secrets.WINDOWS_CERT_BASE64 }}
@@ -300,6 +364,10 @@ jobs:
300364 build-macos :
301365 name : Build macOS App
302366 runs-on : macos-15
367+ # Run if: manual with build_macos OR release with app-v* or v* (but not server-v*)
368+ if : |
369+ (github.event_name == 'workflow_dispatch' && inputs.build_macos) ||
370+ (github.event_name == 'release' && (startsWith(github.event.release.tag_name, 'app-v') || (startsWith(github.event.release.tag_name, 'v') && !startsWith(github.event.release.tag_name, 'server-v'))))
303371 steps :
304372 - name : ' 📄 Checkout'
305373 uses : actions/checkout@v4
@@ -343,8 +411,15 @@ jobs:
343411 - name : ' 📦 Extract version'
344412 id : version
345413 run : |
346- TAG=${{ github.event.release.tag_name }}
347- VERSION=${TAG#v}
414+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
415+ VERSION="${{ inputs.version }}"
416+ TAG="v${VERSION}"
417+ else
418+ TAG=${{ github.event.release.tag_name }}
419+ # Remove app-v or v prefix
420+ VERSION=${TAG#app-v}
421+ VERSION=${VERSION#v}
422+ fi
348423 echo "version=$VERSION" >> $GITHUB_OUTPUT
349424 echo "tag=$TAG" >> $GITHUB_OUTPUT
350425
@@ -412,7 +487,11 @@ jobs:
412487 upload-release :
413488 name : Upload to Release
414489 needs : [build-server, build-android, build-windows, build-macos]
415- if : always() && needs.build-server.result == 'success'
490+ # Run if release event AND at least one build succeeded (not skipped)
491+ if : |
492+ always() &&
493+ github.event_name == 'release' &&
494+ (needs.build-server.result == 'success' || needs.build-android.result == 'success' || needs.build-windows.result == 'success' || needs.build-macos.result == 'success')
416495 runs-on : ubuntu-latest
417496 steps :
418497 - name : ' 📊 Build Status Summary'
0 commit comments