forked from GDQuest/learn-gdscript
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (81 loc) · 2.81 KB
/
Copy pathBuildGodot.yaml
File metadata and controls
84 lines (81 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: "[ BuildGodot ] → gh-pages"
on:
workflow_call:
inputs:
sub_build_path:
required: false
type: string
default: ""
watermark:
required: false
type: string
default: $GITHUB_REPOSITORY:$GITHUB_WORKFLOW:$GITHUB_REF_NAME:$GITHUB_SHA
override_file:
required: false
type: string
default: ""
env:
GODOT_VERSION: 3.4.1
jobs:
export-web:
name: Web Export
runs-on: ubuntu-latest
container:
image: barichello/godot-ci:3.4.1
steps:
- name: Checkout
uses: actions/checkout@v2
with:
lfs: true
- name: Setup
run: |
mkdir -v -p ~/.local/share/godot/templates
mv /root/.local/share/godot/templates/${GODOT_VERSION}.stable ~/.local/share/godot/templates/${GODOT_VERSION}.stable
- name: Install Necessary Software
run: |
apt-get update && apt-get install -y --no-install-recommends sed
- name: Override Configuration
run: |
cp ${{inputs.override_file}} override.cfg && echo "copied override file" || echo "no config override to copy"
- name: Verifying Files' Presence
run: |
echo "Current Files"
ls -la .
- name: Web Build
run: |
mkdir -v -p build/web${{inputs.sub_build_path}}/web && \
godot -v --export "HTML5" build/web${{inputs.sub_build_path}}/index.html || true && \
echo "built godot"
- name: Copy static files
run: |
cp -r html_export/static/* build/web${{inputs.sub_build_path}} && \
echo "copied files"
- name: Add Git Hash to build
run: |
cd build/web${{inputs.sub_build_path}}
sed -i "s@>branch and commit hash@>${{ inputs.watermark }}<@" index.html && \
sed -i "s@GDQUEST_ENVIRONMENT = {}@GDQUEST_ENVIRONMENT = { \
github_repository: '$GITHUB_REPOSITORY',\
github_workflow: '$GITHUB_WORKFLOW',\
github_ref_name: '$GITHUB_REF_NAME',\
github_sha: '$GITHUB_SHA',\
override_file: '${{ inputs.override_file }}',\
sub_build_path: '${{ inputs.sub_build_path }}',\
watermark: '${{ inputs.watermark }}'\
}@" index.html && \
echo "added commit hash to index.html" || echo "failed to add the commit hash"
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
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/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: build/web
clean: false