c #107
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
| # this actions workflow builds large dscript for desktop plus web. It also has | |
| # some steps to deploy to itch.io through their upload program butler. We have a | |
| # copy of the app on itch. | |
| name: "Export Godot" | |
| on: | |
| workflow_call: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - release | |
| - staging | |
| env: | |
| BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} | |
| ITCHIO_USERNAME: ${{ secrets.ITCHIO_USERNAME }} | |
| ITCHIO_GAME: ${{ secrets.ITCHIO_GAME }} | |
| BUILD_GIT_COMMIT: ${{ github.sha }} | |
| BUILD_GIT_BRANCH: ${{ github.ref_name }} | |
| jobs: | |
| # This setup job runs only once and first to prepare the environment to avoid | |
| # downloading Godot and the export templates multiple times. | |
| setup: | |
| name: Setup environment | |
| runs-on: ubuntu-latest | |
| container: registry.gitlab.com/greenfox/godot-build-automation:latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: false | |
| - name: Load .env file | |
| run: | | |
| if [ -f .env ]; then | |
| cat .env >> "$GITHUB_ENV" | |
| else | |
| echo "Warning: .env file not found, skipping" | |
| fi | |
| - name: Install Python 3 | |
| run: apt-get update && apt-get install -y --no-install-recommends python3 | |
| - name: Prepare CI environment | |
| run: python3 build.py prepare ci | |
| - name: Upload prepared source | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: prepared-source | |
| path: | | |
| . | |
| !.git | |
| retention-days: 1 | |
| include-hidden-files: true | |
| export: | |
| name: Export ${{ matrix.platform }} | |
| needs: setup | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [linux, windows, osx, web] | |
| include: | |
| - platform: linux | |
| artifact_name: linux | |
| release_tag: linux | |
| - platform: windows | |
| artifact_name: windows | |
| release_tag: windows | |
| - platform: osx | |
| artifact_name: macos-build | |
| release_tag: osx | |
| - platform: web | |
| artifact_name: web | |
| release_tag: "" | |
| steps: | |
| - name: Checkout for GitHub Pages deploy | |
| if: matrix.platform == 'web' | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: false | |
| - name: Download prepared source | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: prepared-source | |
| - name: Make Godot executable and set up environment | |
| run: | | |
| chmod +x ./godot | |
| echo "$PWD" >> $GITHUB_PATH | |
| echo "GODOT_TEMPLATES_DIR=$PWD/templates" >> $GITHUB_ENV | |
| - name: Load .env file | |
| run: | | |
| if [ -f .env ]; then | |
| cat .env >> "$GITHUB_ENV" | |
| else | |
| echo "Warning: .env file not found, skipping" | |
| fi | |
| - name: Export for ${{ matrix.platform }} | |
| run: python3 build.py export ${{ matrix.platform }} | |
| - name: Push to itch.io | |
| if: github.ref_name == 'release' | |
| run: python3 build.py push ${{ matrix.platform }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: build/${{ matrix.platform }} | |
| retention-days: ${{ matrix.platform == 'osx' && 30 || 90 }} | |
| - name: Upload desktop builds to GitHub Releases | |
| if: matrix.release_tag != '' | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: build/${{ matrix.platform }}/* | |
| tag: ${{ matrix.release_tag }} | |
| file_glob: true | |
| overwrite: true | |
| - name: Deploy web build to GitHub Pages | |
| if: matrix.platform == 'web' | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: gh-pages | |
| folder: build/web | |
| target-folder: ${{ github.ref_name == 'release' && '' || github.ref_name }} | |
| clean: false |