Skip to content

Commit

Permalink
ci: build for web (#20)
Browse files Browse the repository at this point in the history
* ci: build for web

* ci: only deploy on main branch

* chore: fix changelog issue ID
  • Loading branch information
florianvazelle authored Nov 29, 2023
1 parent 77d6252 commit 0964e08
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 14 deletions.
42 changes: 30 additions & 12 deletions .github/workflows/release-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
run: |
[ "${{ env.game_version }}" == "${{ env.BRANCH_NAME }}" ] || exit 2
build:
runs-on: ubuntu-22.04
timeout-minutes: 30
Expand All @@ -48,6 +49,35 @@ jobs:
path: dist/*
retention-days: 1

deploy:
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: [check]

if: github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v1

- name: Load dotenv
run: just ci-load-dotenv

- name: Export
run: just export-web

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

publish:
runs-on: ubuntu-22.04
timeout-minutes: 30
Expand Down Expand Up @@ -75,15 +105,3 @@ jobs:
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# # 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@v4
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# branch: gh-pages
# folder: build/web
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]
### Added
- Add web deploy ([#20](https://github.com/MechanicalFlower/Marble/pull/20))
### Changed
- Use Justfile as command runner ([#18](https://github.com/MechanicalFlower/Marble/pull/18))
### Deprecated
Expand Down
7 changes: 6 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ import-resources:

echo "Create the override.cfg"
touch override.cfg
echo -e "[build_info]\npackage/version={{ game_version }}\npackage/build_date={{ build_date }}\nsource/commit={{ commit_hash }}" > override.cfg
echo '[build_info]\npackage/version="{{ game_version }}"\npackage/build_date="{{ build_date }}"\nsource/commit="{{ commit_hash }}"' > override.cfg

# Godot binary wrapper
@godot *ARGS: makedirs install-godot install-templates
Expand Down Expand Up @@ -148,6 +148,11 @@ export-linux: bump-version install-addons import-resources
mv {{ build_dir }}/linux/{{ game_name }}-linux-v{{ game_version }}.zip {{ dist_dir }}/{{ game_name }}-linux-v{{ game_version }}.zip
rm -rf {{ build_dir }}/linux

# Export game for the web
export-web: bump-version install-addons import-resources
mkdir -p {{ build_dir }}/web
just godot --export-release "Web" --headless {{ build_dir }}/web/index.html

# Export on all platform
export: export-windows export-mac export-linux

Expand Down
2 changes: 2 additions & 0 deletions export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ 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)
include_coi_service_worker=true
iframe_breakout="Disabled"

[preset.2]

Expand Down
1 change: 1 addition & 0 deletions plug.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ extends "res://addons/gd-plug/plug.gd"
func _plugging():
plug("godot-extended-libraries/godot-debug-menu", {"commit": "2d5d67012c76b272173dcfb4947a65dc385fab94"})
plug("KoBeWi/Godot-Universal-Fade", {"commit": "f091514bba652880f81c5bc8809e0ee4498988ea"})
plug("nisovin/godot-coi-serviceworker", {"commit": "962b1abaf14ac62079b9e5321ef98e6f2b09c96e"})
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ window/size/height=720

[editor_plugins]

enabled=PackedStringArray("res://addons/debug_menu/plugin.cfg")
enabled=PackedStringArray("res://addons/debug_menu/plugin.cfg","res://addons/coi_serviceworker/plugin.cfg")

[filesystem]

Expand Down

0 comments on commit 0964e08

Please sign in to comment.