-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (154 loc) · 5.11 KB
/
build.yml
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
name: "Godot Build Pipeline"
on:
push:
tags:
- "v*.*.*"
branches:
- "main"
pull_request:
branches:
- "main"
env:
GODOT_VERSION: "4.3"
PROJECT_PATH: "."
GAME_NAME: "SumZero"
jobs:
build-web:
name: Web Build
runs-on: ubuntu-latest
container:
image: barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v4
with:
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: Web Build
run: |
mkdir -v -p build/web
EXPORT_DIR="$(readlink -f build)"
cd $PROJECT_PATH
godot --headless --verbose --export-release "Web" "$EXPORT_DIR"/web/index.html
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: web
path: build/web
build-windows:
name: Windows Build
runs-on: ubuntu-latest
container:
image: barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
run: |
mkdir -v -p ~/.local/share/godot/export_templates/
mkdir -v -p ~/.config/
mv /root/.config/godot ~/.config/godot
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Windows Build
run: |
mkdir -v -p build/windows
EXPORT_DIR="$(readlink -f build)"
cd $PROJECT_PATH
godot --headless --verbose --export-release "Windows Desktop" "$EXPORT_DIR"/windows/"$GAME_NAME".exe
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: windows
path: build/windows
build-linux:
name: Linux Build
runs-on: ubuntu-latest
container:
image: barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v4
- 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: Linux Build
run: |
mkdir -v -p build/linux
EXPORT_DIR="$(readlink -f build)"
cd $PROJECT_PATH
godot --headless --verbose --export-release "Linux" "$EXPORT_DIR"/linux/"$GAME_NAME".x86_64
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: linux
path: build/linux
create-release:
name: Create Release
needs: [build-web, build-windows, build-linux]
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: builds
- name: Generate Changelog
id: changelog
run: |
# Get changes since last tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -z "$PREVIOUS_TAG" ]; then
# If this is the first tag, get all commits
CHANGELOG=$(git log --pretty=format:"* %s" ${{ github.ref_name }})
else
CHANGELOG=$(git log --pretty=format:"* %s" ${PREVIOUS_TAG}..${{ github.ref_name }})
fi
# Save changelog to a file and escape newlines for Github Actions
echo "$CHANGELOG" > CHANGELOG.md
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Prepare Release Files
run: |
cd builds
VERSION=${GITHUB_REF_NAME#v}
# Web build
cd web
zip -r "../${GAME_NAME}_web_${VERSION}.zip" .
cd ..
# Windows build
cd windows
zip -r "../${GAME_NAME}_windows_${VERSION}.zip" .
cd ..
# Linux build
cd linux
zip -r "../${GAME_NAME}_linux_${VERSION}.zip" .
cd ..
# Generate SHA256 checksums
echo "# SHA256 Checksums" > ../SHA256SUMS.txt
sha256sum ${GAME_NAME}_*.zip >> ../SHA256SUMS.txt
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
builds/${{ env.GAME_NAME }}_web_${{ github.ref_name }}.zip
builds/${{ env.GAME_NAME }}_windows_${{ github.ref_name }}.zip
builds/${{ env.GAME_NAME }}_linux_${{ github.ref_name }}.zip
SHA256SUMS.txt
body: |
## Changes in this release:
${{ steps.changelog.outputs.changelog }}
## SHA256 Checksums
```
$(cat SHA256SUMS.txt)
```
draft: false
prerelease: false