godot_template/.github/workflows/game_web_ci.yml

107 lines
3.2 KiB
YAML
Raw Normal View History

2024-01-06 23:16:38 -05:00
name: "Godot 4.1.2 CI/CD"
2024-01-06 22:51:01 -05:00
env:
GODOT_VERSION: 4.1.2
on:
workflow_dispatch:
push:
branches:
- main
jobs:
2024-01-06 23:28:28 -05:00
web:
2024-01-06 23:16:38 -05:00
runs-on: ubuntu-latest
permissions:
contents: write
container:
image: barichello/godot-ci:4.1.2
steps:
- name: Checkout
uses: actions/checkout@v4
2024-01-06 23:28:28 -05:00
- name: Move export templates into position
2024-01-06 23:16:38 -05:00
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: Create staging directory
2024-01-06 23:22:22 -05:00
run: mkdir -v -p build/web
2024-01-06 23:16:38 -05:00
2024-01-06 23:22:22 -05:00
- name: Build
run: godot -v --export-release --headless "Web"
2024-01-06 23:28:28 -05:00
2024-01-06 23:22:22 -05:00
- name: Add coi-service-worker
2024-01-06 22:51:01 -05:00
run: |
2024-01-06 23:22:22 -05:00
git clone https://github.com/gzuidhof/coi-serviceworker.git
mv coi-serviceworker/coi-serviceworker.js build/web/coi-serviceworker.js
sed -i '3 i <script src="coi-serviceworker.js"></script>' build/web/index.html
2024-01-06 22:51:01 -05:00
2024-01-06 23:22:22 -05:00
- name: Deploy
uses: peaceiris/actions-gh-pages@v3.9.3
2024-01-06 23:16:38 -05:00
with:
2024-01-06 23:22:22 -05:00
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/web
force_orphan: true
user_name: "github-ci[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
commit_message: "UPDATE GITHUB PAGES"
2024-01-06 23:28:28 -05:00
linux:
2024-01-06 23:22:22 -05:00
runs-on: ubuntu-latest
2024-01-06 23:16:38 -05:00
permissions:
contents: write
container:
image: barichello/godot-ci:4.1.2
steps:
- name: Checkout
uses: actions/checkout@v4
2024-01-06 23:28:28 -05:00
- name: Move export templates into position
2024-01-06 23:16:38 -05:00
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: Create staging directory
2024-01-06 23:22:22 -05:00
run: mkdir -v -p build/linux
2024-01-06 23:16:38 -05:00
2024-01-06 23:22:22 -05:00
- name: Build for Linux
run: godot -v --export-release --headless "Linux/X11" --path . --output "build/linux/game.x86_64"
2024-01-06 23:28:28 -05:00
- name: Zip Linux artifacts
run: zip -r game_linux.zip build/linux
- name: Upload Linux artifacts
uses: actions/upload-artifact@v2
with:
name: game_linux
path: build/linux/game_linux.zip
windows:
2024-01-06 23:16:38 -05:00
runs-on: ubuntu-latest
2024-01-06 23:28:28 -05:00
permissions:
contents: write
container:
image: barichello/godot-ci:4.1.2
2024-01-06 23:16:38 -05:00
steps:
2024-01-06 23:28:28 -05:00
- name: Checkout
uses: actions/checkout@v4
- name: Move export templates into position
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: Create staging directory
run: mkdir -v -p build/windows
- name: Build for windows
run: godot -v --export-release --headless "Windows Desktop" --path . --output "build/windows/game.x86_64"
2024-01-06 23:28:28 -05:00
- name: Zip Windows artifacts
run: zip -r game_windows.zip build/windows
- name: Upload windows artifacts
2024-01-06 23:22:22 -05:00
uses: actions/upload-artifact@v2
2024-01-06 22:51:01 -05:00
with:
2024-01-06 23:28:28 -05:00
name: game_windows
path: build/windows/game_windows.zip