Skip to content

GitHub Actions: Export for Linux, Windows, and macOS #17

GitHub Actions: Export for Linux, Windows, and macOS

GitHub Actions: Export for Linux, Windows, and macOS #17

Workflow file for this run

name: "Godot"
on:
workflow_dispatch:
pull_request:
release:
types:
- released
env:
GODOT_VERSION: 4.3
EXPORT_NAME: MuseumOfAllThings
jobs:
export:
name: Export
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Godot Engine downloads
id: cache-godot
uses: actions/cache@v4
with:
path: |
tools/godot
tools/editor_data/export_templates/${{ env.GODOT_VERSION }}.stable
tools/._sc_
key: godot-${{ env.GODOT_VERSION }}
- name: Download Godot Engine
id: download
if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
mkdir -p tools && cd tools
# Download binary from official GitHub release
wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip && \
unzip Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip && \
mv Godot_v${GODOT_VERSION}-stable_linux.x86_64 godot
# Download export templates from official GitHub release
mkdir -p editor_data/export_templates
wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_export_templates.tpz && \
unzip Godot_v${GODOT_VERSION}-stable_export_templates.tpz && \
mv templates editor_data/export_templates/${GODOT_VERSION}.stable
# Tell Godot Engine to be self-contained
touch ._sc_
- name: Ensure path exists
run: mkdir -p dist
- name: Export PCK
run: |
./tools/godot --verbose --headless --export-pack \
"Linux" ./dist/${EXPORT_NAME}.pck
- name: Upload PCK
uses: actions/upload-artifact@v4
with:
name: PCK
path: dist/${{ env.EXPORT_NAME }}.pck
- name: Export Linux
run: |
./tools/godot --verbose --headless --export-release \
"Linux" ./dist/${EXPORT_NAME}_Linux.x86_64
- name: Upload Linux
uses: actions/upload-artifact@v4
with:
name: Linux
path: dist/${{ env.EXPORT_NAME }}_Linux.x86_64
- name: Export Windows Desktop
run: |
./tools/godot --verbose --headless --export-release \
"Windows Desktop" ./dist/${EXPORT_NAME}.exe
- name: Upload Windows Desktop
uses: actions/upload-artifact@v4
with:
name: Windows Desktop
path: dist/${{ env.EXPORT_NAME }}.exe
- name: Export macOS
run: |
./tools/godot --verbose --headless --export-release \
"macOS" ./dist/${EXPORT_NAME}_OSX.zip
- name: Upload macOS
uses: actions/upload-artifact@v4
with:
name: macOS
path: dist/${{ env.EXPORT_NAME }}_OSX.zip
release:
name: Attach to Release
needs: export
permissions: write-all
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Upload artifacts to release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release upload '${{ github.ref_name }}' * --repo '${{ github.repository }}'