-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from endlessm/T35699-publish-to-github-pages
Publish to GitHub Pages
- Loading branch information
Showing
3 changed files
with
131 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
# Normalize EOL for all files that Git considers text files. | ||
* text=auto eol=lf | ||
|
||
# Exclude GitHub Actions-related files from published asset | ||
/.github export-ignore | ||
/asset-template.json.hb export-ignore | ||
# Exclude GitHub Actions-related files from published asset, except the GitHub | ||
# Pages workflow which learners may find useful to publish their modified game. | ||
/.github/** export-ignore | ||
/.github/workflows !export-ignore | ||
/.github/workflows/** export-ignore | ||
/.github/workflows/githuh-pages.yml !export-ignore | ||
/asset-template.json.hb export-ignore | ||
|
||
# Substitute project version when publishing | ||
/project.godot export-subst |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: "Publish to GitHub Pages" | ||
on: | ||
workflow_dispatch: | ||
release: | ||
types: | ||
- published | ||
|
||
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" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[preset.0] | ||
|
||
name="Web" | ||
platform="Web" | ||
runnable=false | ||
advanced_options=false | ||
dedicated_server=false | ||
custom_features="" | ||
export_filter="all_resources" | ||
include_filter="" | ||
exclude_filter="" | ||
export_path="" | ||
encryption_include_filters="" | ||
encryption_exclude_filters="" | ||
encrypt_pck=false | ||
encrypt_directory=false | ||
script_export_mode=2 | ||
|
||
[preset.0.options] | ||
|
||
custom_template/debug="" | ||
custom_template/release="" | ||
variant/extensions_support=false | ||
variant/thread_support=false | ||
vram_texture_compression/for_desktop=true | ||
vram_texture_compression/for_mobile=false | ||
html/export_icon=true | ||
html/custom_html_shell="" | ||
html/head_include="" | ||
html/canvas_resize_policy=2 | ||
html/focus_canvas_on_start=true | ||
html/experimental_virtual_keyboard=false | ||
progressive_web_app/enabled=false | ||
progressive_web_app/ensure_cross_origin_isolation_headers=true | ||
progressive_web_app/offline_page="" | ||
progressive_web_app/display=1 | ||
progressive_web_app/orientation=0 | ||
progressive_web_app/icon_144x144="" | ||
progressive_web_app/icon_180x180="" | ||
progressive_web_app/icon_512x512="" | ||
progressive_web_app/background_color=Color(0, 0, 0, 1) |