Publish to GitHub Pages #13
Workflow file for this run
This file contains 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: "Publish to GitHub Pages" | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
# Cancel any ongoing previous run if the job is re-triggered | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
env: | |
GODOT_VERSION: 4.3 | |
jobs: | |
check: | |
name: Check if GitHub Pages is enabled | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check | |
id: check | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
if gh api "repos/${{ github.repository }}/pages" | jq --exit-status '.build_type == "workflow"' | |
then | |
echo "enabled=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "# Not published to GitHub Pages" >> "$GITHUB_STEP_SUMMARY" | |
echo "" >> "$GITHUB_STEP_SUMMARY" | |
echo -n "Check that Pages is enabled, with the source set to GitHub Actions, in the " >> "$GITHUB_STEP_SUMMARY" | |
echo "[repository settings](https://github.com/${{ github.repository }}/settings/pages)." >> "$GITHUB_STEP_SUMMARY" | |
fi | |
outputs: | |
enabled: ${{ steps.check.outputs.enabled }} | |
build: | |
name: Build for web | |
needs: | |
- check | |
if: ${{ needs.check.outputs.enabled }} | |
runs-on: ubuntu-latest | |
container: | |
image: barichello/godot-ci:4.3 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Set up export templates | |
run: | | |
mkdir -v -p ~/.local/share/godot/export_templates/ | |
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable | |
- name: Web Build | |
run: | | |
mkdir -v -p build/web | |
godot --headless --verbose --export-release "Web" ./build/web/index.html | |
- name: Upload Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: web | |
path: build/web | |
publish: | |
name: Publish to GitHub Pages | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- id: deploy | |
name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 | |
with: | |
artifact_name: web | |
- name: Show URL in summary | |
if: ${{ steps.deploy.outcome == 'success' }} | |
run: | | |
echo "Game published to: <${{ steps.deploy.outputs.page_url }}>" >> "$GITHUB_STEP_SUMMARY" |