TimeAndWeather: Reduce night 2 hours (#2391) #5984
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
| # SPDX-FileCopyrightText: The Threadbare Authors | |
| # SPDX-License-Identifier: MPL-2.0 | |
| name: "Build and Export Game" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| build_windows: | |
| description: "Also build for Windows" | |
| type: boolean | |
| build_flatpak: | |
| description: "Also build a Flatpak bundle" | |
| type: boolean | |
| pull_request: | |
| release: | |
| types: | |
| - published | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| env: | |
| PCK_NAME: threadbare | |
| jobs: | |
| web: | |
| name: Build for web | |
| runs-on: ubuntu-latest | |
| outputs: | |
| linux-changed: ${{ steps.changes.outputs.linux }} | |
| windows-changed: ${{ steps.changes.outputs.windows }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| # Fetch full history of commits and tags so that git describe --tags works | |
| fetch-depth: 0 | |
| - uses: ./.github/actions/lfs-cached-checkout | |
| - name: Export web build | |
| uses: endlessm/godot-export-action@v2 | |
| with: | |
| godot_version: "4.6.3" | |
| export_preset: "Web" | |
| - name: Upload web artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: web | |
| path: build/web | |
| # This check needs the LFS objects to have been fetched and the project | |
| # imported into Godot. Do it here rather than in a separate job to save | |
| # time & electrons. | |
| - name: Check GDScript diagnostics | |
| run: | | |
| python tools/check-gdscript-lsp-diagnostics.py --godot build/godot || \ | |
| echo "::warning::GDScript diagnostics check failed (exit code $?)" | |
| # This could be a separate job but this one runs every time anyway. | |
| - name: Check if Windows & Linux builds should be run | |
| id: changes | |
| uses: dorny/paths-filter@v4 | |
| with: | |
| filters: | | |
| linux: | |
| - 'linux/**' | |
| - .github/workflows/export.yml | |
| windows: | |
| - export_presets.cfg | |
| - .github/workflows/export.yml | |
| windows: | |
| name: Build for Windows | |
| runs-on: ubuntu-latest | |
| needs: web | |
| if: ${{ inputs.build_windows || github.event_name == 'release' || needs.web.outputs.windows-changed == 'true' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| # Fetch full history of commits and tags so that git describe --tags works | |
| fetch-depth: 0 | |
| - uses: ./.github/actions/lfs-cached-checkout | |
| - name: Export Windows build | |
| uses: endlessm/godot-export-action@v2 | |
| with: | |
| godot_version: "4.6.2" | |
| export_preset: "Windows x86_64" | |
| - name: Upload Windows artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: windows-x86_64 | |
| path: build/windows-x86_64 | |
| flatpak: | |
| name: Build Flatpak | |
| needs: web | |
| if: ${{ inputs.build_flatpak || github.event_name == 'release' || needs.web.outputs.linux-changed == 'true' }} | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08 | |
| options: --privileged | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| lfs: true | |
| sparse-checkout: | | |
| linux | |
| - name: Download Artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| name: web | |
| path: build | |
| - name: Rename pck file | |
| run: | | |
| mv build/index.pck build/threadbare.pck | |
| - uses: flatpak/flatpak-github-actions/flatpak-builder@v6 | |
| with: | |
| bundle: threadbare.flatpak | |
| manifest-path: linux/org.endlessaccess.threadbare.yml | |
| cache-key: "flatpak-builder-${{ github.sha }}" | |
| - name: Create Linux metadata bundle | |
| run: | | |
| tar --create --gzip \ | |
| --dereference \ | |
| --file threadbare-linux-metadata.tar.gz \ | |
| --transform=s,^,threadbare-linux-metadata/, \ | |
| linux/* | |
| - name: Upload Linux metadata bundle | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| path: threadbare-linux-metadata.tar.gz | |
| archive: false | |
| release: | |
| name: Attach to release | |
| needs: [web, flatpak, windows] | |
| if: ${{ github.event_name == 'release' }} | |
| runs-on: ubuntu-latest | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| steps: | |
| - name: Download web bundle | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: web | |
| skip-decompress: true | |
| - name: Download Windows x86_64 bundle | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: windows-x86_64 | |
| skip-decompress: true | |
| - name: Download Flatpak bundle | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: threadbare-x86_64.flatpak | |
| - name: Download Linux metadata bundle | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: threadbare-linux-metadata.tar.gz | |
| - name: Attach assets to release | |
| shell: bash | |
| run: | | |
| set -ex | |
| unzip web.zip index.pck | |
| mv index.pck 'threadbare-${{ github.ref_name }}.pck' | |
| mv web.zip 'threadbare-${{ github.ref_name }}-web.zip' | |
| mv windows-x86_64.zip 'threadbare-${{ github.ref_name }}-windows-x86_64.zip' | |
| mv threadbare.flatpak 'threadbare-${{ github.ref_name }}-linux-x86_64.flatpak' | |
| mv threadbare-linux-metadata.tar.gz 'threadbare-${{ github.ref_name }}-linux-metadata.tar.gz' | |
| for file in threadbare-${{ github.ref_name }}*; do | |
| gh release upload '${{ github.ref_name }}' "$file" --repo '${{ github.repository }}' | |
| done |