Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Web Build and GitHub Pages Deployment Automation #24

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/github_pages_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: 🚀 Deploy Github Pages Demo
on:
workflow_dispatch:
repository_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Stop the same workflow actions
concurrency:
group: ${{github.workflow}}-${{github.event.pull_request.number || github.run_id}}
cancel-in-progress: true

# Environment variables for the job
env:
GODOT_VERSION: 4.1.1
PROJECT_PATH: dd3d_web_build

jobs:
build:
name: 🌐 Build Project
runs-on: ubuntu-20.04
container:
image: barichello/godot-ci:4.1.1
nicholas-maltbie marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Check out code
uses: actions/checkout@v3
with:
lfs: true

- name: Setup
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: Prepare Web Build
run: |
cp -r addons ${PROJECT_PATH}/addons
cp -r examples_dd3d ${PROJECT_PATH}/examples_dd3d

- name: Import Assets
run: godot -v -e --headless --path ${PROJECT_PATH} --quit || true

- name: Web Build
run: |
mkdir ${GITHUB_WORKSPACE}/_site
cp ${PROJECT_PATH}/coi-serviceworker.min.js ${GITHUB_WORKSPACE}/_site/coi-serviceworker.min.js
godot -v --headless --path ${PROJECT_PATH} --export-release web ${GITHUB_WORKSPACE}/_site/index.html

- name: Fix Permissions
run: |
chmod -c -R +rX "_site/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done

- name: Upload Site Artifact
uses: actions/upload-pages-artifact@v1
with:
name: github-pages

deploy:
name: 🚀 Deploy Site
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
2 changes: 2 additions & 0 deletions dd3d_web_build/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
9 changes: 9 additions & 0 deletions dd3d_web_build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Godot 4+ specific ignores
.godot/

# Copied files for testing
examples_dd3d/
addons/

# Exported builds
build/
24 changes: 24 additions & 0 deletions dd3d_web_build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Web Build

Setup repo following guide from [Debug drawing utility for Godot](../addons/debug_draw_3d/README.md)

Ensure you have the [Godot Export Templates for v4.1.1-stable](https://github.com/godotengine/godot/releases/download/4.1.1-stable/Godot_v4.1.1-stable_export_templates.tpz).
This requires having installed the `web_dlink_debug.zip` template.
Or you can compile one yourself with godot, see [Compiling for Web: GDExtension](https://docs.godotengine.org/en/stable/contributing/development/compiling/compiling_for_web.html#gdextension)

```PowerShell
# Copy addons to project
cp -r addons/ dd3d_web_build/addons/

# Copy examples to project
cp -r examples_dd3d/ dd3d_web_build/examples_dd3d/

# Build the project for web platform with godot
mkdir -p dd3d_web_build/build
cp dd3d_web_build/coi-serviceworker.min.js dd3d_web_build/build/coi-serviceworker.min.js
godot -e --headless --path dd3d_web_build --quit
godot --headless --path dd3d_web_build --export-release web

# Host site locally via python
python -m http.server --directory dd3d_web_build/build
```
2 changes: 2 additions & 0 deletions dd3d_web_build/coi-serviceworker.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions dd3d_web_build/export_presets.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[preset.0]

name="web"
platform="Web"
runnable=true
dedicated_server=false
custom_features="forced_dd3d"
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="build/DebugDrawDemo.html"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false

[preset.0.options]

custom_template/debug=""
custom_template/release=""
variant/extensions_support=true
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=true
html/export_icon=true
html/custom_html_shell=""
html/head_include="<script src=\"coi-serviceworker.min.js\"></script>"
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=false
progressive_web_app/enabled=false
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)
1 change: 1 addition & 0 deletions dd3d_web_build/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions dd3d_web_build/icon.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://1ju8du5cumca"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
22 changes: 22 additions & 0 deletions dd3d_web_build/project.godot
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters

config_version=5

[application]

config/name="Debug Drawing Utility for Godot"
run/main_scene="res://examples_dd3d/DebugDrawDemoScene.tscn"
config/features=PackedStringArray("4.1", "GL Compatibility")
config/icon="res://icon.svg"

[rendering]

renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
textures/vram_compression/import_etc2_astc=true