Skip to content

Commit

Permalink
Add web deployment to build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
2shady4u committed Aug 27, 2024
1 parent 49c6245 commit 6ad9996
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ env:
VAR_PATH: .github/workflows/build_var.json
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
EM_VERSION: 3.1.64
EM_CACHE_FOLDER: "emsdk-cache"
EM_CACHE_FOLDER: emsdk-cache
GODOT_VERSION: 4.3
EXPORT_NAME: ./demo/

jobs:
matrix:
Expand Down Expand Up @@ -124,6 +126,56 @@ jobs:
path: ${{ env.ARTIFACT_FOLDER }}*.${{ matrix.artifact-extension }}
if-no-files-found: error

web-deploy:
name: Web Deploy
runs-on: ubuntu-latest
needs: [ build ]
container:
image: barichello/godot-ci:4.3 # Ideally this would be ${GODOT_VERSION}, but Github Actions doesn't allow this! :(

steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true

- name: Download Artefacts
uses: actions/download-artifact@v4

- name: Copy Libraries to Project Folder
run: |
mkdir -v -p ${{ env.PROJECT_FOLDER }}/${{ env.TARGET_PATH }}
cp --verbose web-wasm32-*/*.wasm ${{ env.PROJECT_FOLDER }}/${{ env.TARGET_PATH }}
- 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: Web Build
run: |
mkdir -v -p build/web
cd $EXPORT_NAME
godot --headless --verbose --export-release "Web" ../build/web/index.html
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: web
path: build/web

# Installing rsync is needed in order to deploy to GitHub Pages. Without it, the build will fail.
- name: Install rsync 📚
run: |
apt-get update && apt-get install -y rsync
- name: Deploy to GitHub Pages 🚀
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: build/web # The folder the action should deploy.

release:
name: Release
runs-on: "ubuntu-20.04"
Expand Down

0 comments on commit 6ad9996

Please sign in to comment.