Skip to content

Commit

Permalink
fix(workflow): change workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
enzoritto authored Oct 1, 2024
1 parent 976e2cc commit ce07882
Showing 1 changed file with 83 additions and 169 deletions.
252 changes: 83 additions & 169 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,202 +1,116 @@
name: "Godot 4.3 CI/CD"
name: "Godot-ci export"
on: push

env:
GODOT_VERSION: 4.3

on:
workflow_dispatch:
push:
branches:
- main
EXPORT_NAME: zombie-dash
PROJECT_PATH: .

jobs:
web:
runs-on: ubuntu-latest
permissions:
contents: write
export-windows:
name: Windows Export
runs-on: ubuntu-20.04
container:
image: barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Move export templates into position
uses: actions/checkout@v4
with:
lfs: true
- name: Setup
run: |
mkdir -v -p ~/.local/share/godot/export_templates
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/web

- name: Build
run: godot -v --export-release --headless "Web"

- name: Add coi-service-worker
- name: Windows Build
run: |
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
- name: Deploy
uses: peaceiris/[email protected]
mkdir -v -p build/windows
cd $PROJECT_PATH
godot --headless --verbose --export-release "Windows Desktop" ../build/windows/$EXPORT_NAME.exe
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
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"

- name: Zip Web artifacts
run: zip -r game_web.zip build/web

- name: Upload Web artifacts
uses: actions/upload-artifact@v3
with:
name: game_web
path: game_web.zip
linux:
runs-on: ubuntu-latest
permissions:
contents: write
name: windows
path: build/windows

export-linux:
name: Linux Export
runs-on: ubuntu-20.04
container:
image: barichello/godot-ci:4.3

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Move export templates into position
uses: actions/checkout@v4
with:
lfs: true
- name: Setup
run: |
mkdir -v -p ~/.local/share/godot/export_templates
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/linux

- name: Build for Linux
run: godot -v --export-release --headless "Linux/X11" --path . --output "build/linux/game.x86_64"

- name: Zip Linux artifacts
run: zip -r game_linux.zip build/linux

- name: Upload Linux artifacts
uses: actions/upload-artifact@v3
- name: Linux Build
run: |
mkdir -v -p build/linux
cd $PROJECT_PATH
godot --headless --verbose --export-release "Linux/X11" ../build/linux/$EXPORT_NAME.x86_64
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: game_linux
path: game_linux.zip
windows:
runs-on: ubuntu-latest
permissions:
contents: write
name: linux
path: build/linux

export-web:
name: Web Export
runs-on: ubuntu-20.04
container:
image: barichello/godot-ci:4.3

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Move export templates into position
uses: actions/checkout@v4
with:
lfs: true
- name: Setup
run: |
mkdir -v -p ~/.local/share/godot/export_templates
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"

- name: Zip Windows artifacts
run: zip -r game_windows.zip build/windows

- name: Upload windows artifacts
uses: actions/upload-artifact@v3
with:
name: game_windows
path: game_windows.zip
release:
needs: [web, linux, windows]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: "5.x"

- name: Execute GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: GitVersion.yml

- name: Get branch name
id: get_branch
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: game_web

- name: Download Linux artifacts
uses: actions/download-artifact@v3
with:
name: game_linux

- name: Download Windows artifacts
uses: actions/download-artifact@v3
with:
name: game_windows

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Web Build
run: |
mkdir -v -p build/web
cd $PROJECT_PATH
godot --headless --verbose --export-release "HTML5" ../build/web/index.html
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
tag_name: ${{env.GitVersion_MajorMinorPatch}}
release_name: ${{env.GitVersion_MajorMinorPatch}}
body: |
Release notes for ${{env.GitVersion_MajorMinorPatch}}
draft: false
prerelease: true

- name: Upload Web Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: web
path: build/web
- 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:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: game_web.zip
asset_name: Godot_Game_Web.zip
asset_content_type: application/zip
branch: gh-pages # The branch the action should deploy to.
folder: build/web # The folder the action should deploy.

- name: Upload Linux Release Asset
id: upload-linux-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
export-mac:
name: Mac Export
runs-on: ubuntu-20.04
container:
image: barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v4
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: game_linux.zip
asset_name: Godot_Game_Linux.zip
asset_content_type: application/zip

- name: Upload Windows Release Asset
id: upload-windows-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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: Mac Build
run: |
mkdir -v -p build/mac
cd $PROJECT_PATH
godot --headless --verbose --export-release "Mac OSX" ../build/mac/$EXPORT_NAME.zip
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: game_windows.zip
asset_name: Godot_Game_Windows.zip
asset_content_type: application/zip
name: mac
path: build/mac

0 comments on commit ce07882

Please sign in to comment.