ci: allow release platforms to run independently with presets and tolerant publishing

Co-Authored-By: pgwiz <pgwiz@users.noreply.github.com>
This commit is contained in:
pgwiz 2026-10-28 10:40:04 +03:00
parent dd098aea0a
commit 91ea775b77

View File

@ -12,6 +12,52 @@ on:
- stable - stable
- beta - beta
- nightly - nightly
target_preset:
description: 'Target preset'
required: true
type: choice
default: 'all'
options:
- all
- desktop
- desktop-no-mac
- mobile
- windows
- linux
- macos
- android
- ios
- custom
build_windows:
description: ' -> Windows x86_64 (.exe) (if custom)'
required: false
type: boolean
default: true
build_linux:
description: ' -> Linux x86_64 (.deb, .rpm, .AppImage, .tar.xz) (if custom)'
required: false
type: boolean
default: true
build_linux_arm64:
description: ' -> Linux ARM64 (.deb, .rpm, .AppImage, .tar.xz) (if custom)'
required: false
type: boolean
default: true
build_macos:
description: ' -> macOS Universal (.dmg) (if custom)'
required: false
type: boolean
default: true
build_android:
description: ' -> Android (.apk) (if custom)'
required: false
type: boolean
default: true
build_ios:
description: ' -> iOS (.ipa) (if custom)'
required: false
type: boolean
default: true
dry_run: dry_run:
description: 'Dry run (build & upload artifacts only, skip creating release)' description: 'Dry run (build & upload artifacts only, skip creating release)'
required: false required: false
@ -78,6 +124,7 @@ jobs:
build-android: build-android:
name: Android name: Android
if: ${{ inputs.target_preset == 'all' || inputs.target_preset == 'mobile' || inputs.target_preset == 'android' || inputs.target_preset == '' || (inputs.target_preset == 'custom' && inputs.build_android) }}
needs: prepare-deps needs: prepare-deps
timeout-minutes: 120 timeout-minutes: 120
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -155,6 +202,7 @@ jobs:
build-linux: build-linux:
name: Linux Desktop name: Linux Desktop
if: ${{ inputs.target_preset == 'all' || inputs.target_preset == 'desktop' || inputs.target_preset == 'desktop-no-mac' || inputs.target_preset == 'linux' || inputs.target_preset == '' || (inputs.target_preset == 'custom' && inputs.build_linux) }}
needs: prepare-deps needs: prepare-deps
timeout-minutes: 120 timeout-minutes: 120
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -268,6 +316,7 @@ jobs:
build-linux-arm64: build-linux-arm64:
name: Linux Desktop (aarch64) name: Linux Desktop (aarch64)
if: ${{ inputs.target_preset == 'all' || inputs.target_preset == 'desktop' || inputs.target_preset == 'desktop-no-mac' || inputs.target_preset == 'linux' || inputs.target_preset == '' || (inputs.target_preset == 'custom' && inputs.build_linux_arm64) }}
needs: prepare-deps needs: prepare-deps
timeout-minutes: 120 timeout-minutes: 120
runs-on: ubuntu-24.04-arm runs-on: ubuntu-24.04-arm
@ -388,6 +437,7 @@ jobs:
build-windows: build-windows:
name: Windows Desktop name: Windows Desktop
if: ${{ inputs.target_preset == 'all' || inputs.target_preset == 'desktop' || inputs.target_preset == 'desktop-no-mac' || inputs.target_preset == 'windows' || inputs.target_preset == '' || (inputs.target_preset == 'custom' && inputs.build_windows) }}
needs: prepare-deps needs: prepare-deps
timeout-minutes: 120 timeout-minutes: 120
runs-on: windows-latest runs-on: windows-latest
@ -451,6 +501,7 @@ jobs:
build-macos: build-macos:
name: macOS Desktop name: macOS Desktop
if: ${{ inputs.target_preset == 'all' || inputs.target_preset == 'desktop' || inputs.target_preset == 'macos' || inputs.target_preset == '' || (inputs.target_preset == 'custom' && inputs.build_macos) }}
needs: prepare-deps needs: prepare-deps
timeout-minutes: 120 timeout-minutes: 120
runs-on: macos-latest runs-on: macos-latest
@ -519,6 +570,7 @@ jobs:
build-ios: build-ios:
name: iOS name: iOS
if: ${{ inputs.target_preset == 'all' || inputs.target_preset == 'mobile' || inputs.target_preset == 'ios' || inputs.target_preset == '' || (inputs.target_preset == 'custom' && inputs.build_ios) }}
needs: prepare-deps needs: prepare-deps
timeout-minutes: 120 timeout-minutes: 120
runs-on: macos-latest runs-on: macos-latest
@ -588,8 +640,9 @@ jobs:
create-release: create-release:
name: Create GitHub Release name: Create GitHub Release
if: ${{ !inputs.dry_run }} if: ${{ !inputs.dry_run && !cancelled() && always() }}
needs: needs:
- prepare-deps
- build-android - build-android
- build-linux - build-linux
- build-linux-arm64 - build-linux-arm64
@ -639,9 +692,23 @@ jobs:
echo "tag=${TAG}" >> "$GITHUB_OUTPUT" echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
- name: Download all artifacts - name: Download all artifacts
continue-on-error: true
uses: actions/download-artifact@v8 uses: actions/download-artifact@v8
- name: Verify build artifacts exist
id: check_artifacts
run: |
COUNT=$(find . -maxdepth 2 -type f \( -name "*.apk" -o -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" -o -name "*.tar.xz" -o -name "*.exe" -o -name "*.dmg" -o -name "*.ipa" \) 2>/dev/null | wc -l)
echo "Found $COUNT build artifact(s)."
if [ "$COUNT" -eq 0 ]; then
echo "has_artifacts=false" >> "$GITHUB_OUTPUT"
echo "No build artifacts were found. Skipping release publish step."
else
echo "has_artifacts=true" >> "$GITHUB_OUTPUT"
fi
- name: Generate release notes - name: Generate release notes
if: steps.check_artifacts.outputs.has_artifacts == 'true'
run: | run: |
echo "## Downloads" > release-notes.md echo "## Downloads" > release-notes.md
echo "" >> release-notes.md echo "" >> release-notes.md
@ -649,19 +716,20 @@ jobs:
if [ -d "$dir" ]; then if [ -d "$dir" ]; then
echo "### $dir" >> release-notes.md echo "### $dir" >> release-notes.md
for f in "$dir"/*; do for f in "$dir"/*; do
echo "- \`$(basename "$f")\`" >> release-notes.md [ -f "$f" ] && echo "- \`$(basename "$f")\`" >> release-notes.md
done done
echo "" >> release-notes.md echo "" >> release-notes.md
fi fi
done done
- name: Create Release - name: Create or Update Release
if: steps.check_artifacts.outputs.has_artifacts == 'true'
uses: softprops/action-gh-release@v3 uses: softprops/action-gh-release@v3
with: with:
tag_name: ${{ steps.vars.outputs.tag }} tag_name: ${{ steps.vars.outputs.tag }}
# A new tag (stable) would otherwise point at the default branch instead of the built commit # A new tag (stable) would otherwise point at the default branch instead of the built commit
target_commitish: ${{ github.sha }} target_commitish: ${{ github.sha }}
fail_on_unmatched_files: true fail_on_unmatched_files: false
name: ${{ steps.vars.outputs.release_name }} name: ${{ steps.vars.outputs.release_name }}
body_path: release-notes.md body_path: release-notes.md
draft: ${{ steps.vars.outputs.is_draft }} draft: ${{ steps.vars.outputs.is_draft }}