Build and Release Spectrum Client #100
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release Spectrum Client | |
| on: | |
| # Scheduled nightly dev build (~4 AM NZ) | |
| schedule: | |
| # UTC 15:00 = NZDT 4:00 AM (NZST ~3 AM) | |
| - cron: "0 15 * * *" | |
| # Manual trigger for both dev and release builds | |
| workflow_dispatch: | |
| inputs: | |
| build_type: | |
| description: "Build type" | |
| required: true | |
| default: dev | |
| type: choice | |
| options: | |
| - dev | |
| - release | |
| version: | |
| description: "Version tag (required for release builds, e.g. v1.2.3)" | |
| required: false | |
| type: string | |
| jobs: | |
| export_spectrum: | |
| name: Build Spectrum Client | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| # Only manual workflow_dispatch + build_type=release may create release/tag | |
| env: | |
| IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' && inputs.build_type == 'release' }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| lfs: true | |
| fetch-depth: 0 | |
| - name: Compute build version | |
| id: version | |
| run: | | |
| if [[ "${{ env.IS_RELEASE }}" == "true" ]]; then | |
| if [[ -z "${{ inputs.version }}" ]]; then | |
| echo "❌ Release builds require a version" | |
| exit 1 | |
| fi | |
| echo "VERSION=${{ inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| DATE=$(date -u +"%Y%m%d") | |
| SHA=$(git rev-parse --short HEAD) | |
| echo "VERSION=dev-${DATE}-${SHA}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Export Spectrum | |
| id: export | |
| uses: firebelley/[email protected] | |
| with: | |
| godot_executable_download_url: https://github.com/not-my-username/godot/releases/download/4.5.2-so_reusraddr/godot.linuxbsd.editor.x86_64.zip | |
| godot_export_templates_download_url: https://github.com/not-my-username/godot/releases/download/4.5.2-so_reusraddr/4.5.2.stablereuseaddr.zip | |
| relative_project_path: ./ | |
| archive_output: true | |
| cache: true | |
| presets_to_export: windows.x86_64, macOS.universal, linux.x86_64 | |
| - name: Rename Archives | |
| run: | | |
| cd ${{ steps.export.outputs.archive_directory }} | |
| mv linux.x86_64.zip SpectrumClient.x86_64.linux.${{ steps.version.outputs.VERSION }}.zip | |
| mv windows.x86_64.zip SpectrumClient.x86_64.windows.${{ steps.version.outputs.VERSION }}.zip | |
| mv macOS.universal.zip SpectrumClient.universal.macOS.${{ steps.version.outputs.VERSION }}.zip | |
| # --- Dev builds: tag commit and update "Latest dev build" release --- | |
| - name: Tag current commit for Latest Dev Build | |
| if: env.IS_RELEASE != 'true' | |
| run: | | |
| TAG_NAME=latest-dev-build | |
| # Delete local tag if it exists | |
| git tag -d $TAG_NAME || true | |
| # Delete remote tag if it exists | |
| git push origin :refs/tags/$TAG_NAME || true | |
| # Tag the current commit | |
| git tag $TAG_NAME $GITHUB_SHA | |
| git push origin $TAG_NAME | |
| - name: Update "Latest dev build" release | |
| if: env.IS_RELEASE != 'true' | |
| uses: ncipollo/[email protected] | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: latest-dev-build | |
| name: Latest dev build | |
| prerelease: true | |
| allowUpdates: true | |
| removeArtifacts: true | |
| replacesArtifacts: true | |
| artifacts: ${{ steps.export.outputs.archive_directory }}/* | |
| # --- Release builds: create version tag --- | |
| - name: Create git tag | |
| if: env.IS_RELEASE == 'true' | |
| run: | | |
| git tag ${{ steps.version.outputs.VERSION }} | |
| git push origin ${{ steps.version.outputs.VERSION }} | |
| # --- Release builds: create release --- | |
| - name: Create GitHub Release | |
| if: env.IS_RELEASE == 'true' | |
| uses: ncipollo/[email protected] | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ steps.version.outputs.VERSION }} | |
| name: ${{ steps.version.outputs.VERSION }} | |
| generateReleaseNotes: true | |
| artifacts: ${{ steps.export.outputs.archive_directory }}/* |