-
-
Notifications
You must be signed in to change notification settings - Fork 237
171 lines (150 loc) · 4.93 KB
/
Copy pathExportGodot.yaml
File metadata and controls
171 lines (150 loc) · 4.93 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Export desktop and web builds, publish them to itch.io, and deploy the web build.
name: "Export Godot"
on:
workflow_dispatch:
push:
branches:
- release
- staging
permissions:
contents: read
concurrency:
group: export-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
BUILD_GIT_COMMIT: ${{ github.sha }}
BUILD_GIT_BRANCH: ${{ github.ref_name }}
jobs:
# This setup job runs only once and first to prepare the environment to avoid
# downloading Godot and the export templates multiple times.
setup:
name: Setup environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
with:
lfs: false
- name: Restore build downloads
uses: actions/cache@v6.1.0
with:
path: .cache/build-downloads
key: export-build-downloads-${{ runner.os }}-${{ hashFiles('.env') }}
- name: Prepare CI environment
run: python3 build.py prepare ci
- name: Upload prepared source
uses: actions/upload-artifact@v7.0.1
with:
name: prepared-source
path: |
.
!.git
!.cache
retention-days: 1
include-hidden-files: true
export:
name: Export ${{ matrix.platform }}
needs: setup
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
platform: ${{ fromJSON(github.ref_name == 'release' && '["linux", "windows", "osx", "web"]' || '["web"]') }}
steps:
- name: Download prepared source
uses: actions/download-artifact@v8.0.1
with:
name: prepared-source
- name: Set up export tools
run: |
chmod +x godot_server.x86_64
chmod +x butler
echo "GODOT_TEMPLATES_DIR=$PWD/templates" >> $GITHUB_ENV
- name: Export for ${{ matrix.platform }}
run: python3 build.py export ${{ matrix.platform }}
- name: Push to itch.io
if: github.ref_name == 'release' || github.ref_name == 'staging'
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
ITCHIO_USERNAME: ${{ secrets.ITCHIO_USERNAME }}
ITCHIO_GAME: ${{ secrets.ITCHIO_GAME }}
run: python3 build.py push ${{ matrix.platform }}
- name: Upload release artifact
if: github.ref_name == 'release'
uses: actions/upload-artifact@v7.0.1
with:
name: build-${{ matrix.platform }}
path: build/${{ matrix.platform }}
retention-days: 1
- name: Upload staging artifact
if: github.ref_name == 'staging'
uses: actions/upload-artifact@v7.0.1
with:
name: build-${{ matrix.platform }}
path: build/${{ matrix.platform }}/${{ github.ref_name }}
retention-days: 1
deploy-pages:
name: Deploy web build to GitHub Pages
if: github.ref_name == 'release' || github.ref_name == 'staging'
needs: export
runs-on: ubuntu-latest
permissions:
contents: write
environment:
name: github-pages
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
with:
lfs: false
- name: Download web artifact
uses: actions/download-artifact@v8.0.1
with:
name: build-web
path: build/web
- name: Deploy release web build
if: github.ref_name == 'release'
# 4.8.0 pinned commit
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: build/web
target-folder: ''
clean: false
- name: Deploy staging web build
if: github.ref_name == 'staging'
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: build/web
target-folder: staging
clean: false
publish:
name: Publish builds
if: github.ref_name == 'release' || github.ref_name == 'staging'
needs: export
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download builds
uses: actions/download-artifact@v8.0.1
with:
pattern: build-*
path: ${{ runner.temp }}/builds
- name: Upload GitHub release assets
if: github.ref_name == 'release'
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
# Updates a single latest release for each platform.
run: |
for platform in linux windows osx web; do
gh release view "$platform" > /dev/null 2>&1 || \
gh release create "$platform" --target "$GITHUB_SHA" --title "$platform" --notes ""
gh release upload "$platform" "$RUNNER_TEMP/builds/build-$platform"/* --clobber
done