-
Notifications
You must be signed in to change notification settings - Fork 5
142 lines (127 loc) · 5.57 KB
/
main.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
name: Automatic builds
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- '*'
jobs:
build_application:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract Version & Determine Patch
id: version_info
run: |
MAJOR_MINOR=$(grep "var major_minor" Autoload/Version.gd | awk -F\" '{print $2}')
PATCH=$(git rev-list --count HEAD)
FULL_VERSION="$MAJOR_MINOR.$PATCH"
echo "FULL_VERSION=$FULL_VERSION" >> $GITHUB_OUTPUT
echo "PATCH=$PATCH" >> $GITHUB_ENV
- name: Update Version in Godot Script
run: |
sed -i "s/var patch = .*/var patch = \"$PATCH\"/" Autoload/Version.gd
- name: Setup Godot and Export Templates
run: |
wget -q https://github.com/godotengine/godot/releases/download/3.5.3-stable/Godot_v3.5.3-stable_linux_headless.64.zip
wget -q https://github.com/godotengine/godot/releases/download/3.5.3-stable/Godot_v3.5.3-stable_export_templates.tpz
unzip -q Godot_v3.5.3-stable_linux_headless.64.zip
unzip -q Godot_v3.5.3-stable_export_templates.tpz
mkdir -p ~/.local/share/godot/templates/3.5.3.stable/
mv templates/* ~/.local/share/godot/templates/3.5.3.stable/
chmod +x Godot_v3.5.3-stable_linux_headless.64
- name: Prepare Directories
run: |
rm -rf ./bin
mkdir -p ./bin/ExportLinux/Unearth ./bin/ExportWindows/Unearth
- name: Export Godot Game (Linux)
run: ./Godot_v3.5.3-stable_linux_headless.64 --export "Linux/X11" ./bin/ExportLinux/Unearth/Unearth.x86_64
- name: Export Godot Game (Windows)
run: ./Godot_v3.5.3-stable_linux_headless.64 --export "Windows Desktop" ./bin/ExportWindows/Unearth/Unearth.exe
- name: Install Wine
run: |
sudo apt-get update
sudo apt-get install -y wine64
- name: Download rcedit
run: |
wget https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -O rcedit.exe
- name: Set Executable Details and Replace Icon in Windows Export with rcedit
run: |
wine64 rcedit.exe ./bin/ExportWindows/Unearth/Unearth.exe \
--set-icon Art/icon/UnearthIcon.ico \
--set-version-string FileDescription "Unearth Editor for Dungeon Keeper" \
--set-file-version ${{ steps.version_info.outputs.FULL_VERSION }} \
--set-version-string ProductName "Unearth" \
--set-product-version ${{ steps.version_info.outputs.FULL_VERSION }} \
--set-version-string LegalCopyright "Open Source"
- name: Upload Linux Artifacts
uses: actions/upload-artifact@v3
with:
name: unearth-${{ steps.version_info.outputs.FULL_VERSION }}-linux
path: ./bin/ExportLinux/Unearth/
- name: Upload Windows Artifacts
uses: actions/upload-artifact@v3
with:
name: unearth-${{ steps.version_info.outputs.FULL_VERSION }}-windows
path: ./bin/ExportWindows/Unearth/
- name: Install Butler
if: startsWith(github.ref, 'refs/tags/')
run: |
curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
unzip -o butler.zip
chmod +x butler
./butler -V
- name: Zip Linux Build for Release
if: startsWith(github.ref, 'refs/tags/')
run: |
cd ./bin/ExportLinux/
zip -r ../unearth-${{ steps.version_info.outputs.FULL_VERSION }}-linux.zip Unearth/
- name: Zip Windows Build for Release
if: startsWith(github.ref, 'refs/tags/')
run: |
cd ./bin/ExportWindows/
zip -r ../unearth-${{ steps.version_info.outputs.FULL_VERSION }}-windows.zip Unearth/
- name: Upload to itch.io
if: startsWith(github.ref, 'refs/tags/')
env:
BUTLER_API_KEY: ${{ secrets.ITCHIO_API_KEY }}
run: |
./butler push ./bin/unearth-${{ steps.version_info.outputs.FULL_VERSION }}-linux.zip rainlizard/unearth:linux --userversion ${{ steps.version_info.outputs.FULL_VERSION }}
./butler push ./bin/unearth-${{ steps.version_info.outputs.FULL_VERSION }}-windows.zip rainlizard/unearth:windows --userversion ${{ steps.version_info.outputs.FULL_VERSION }}
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version_info.outputs.FULL_VERSION }}
release_name: ${{ steps.version_info.outputs.FULL_VERSION }}
draft: false
prerelease: false
- name: Upload Zipped Linux Artifact to Release
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/unearth-${{ steps.version_info.outputs.FULL_VERSION }}-linux.zip
asset_name: unearth-${{ steps.version_info.outputs.FULL_VERSION }}-linux.zip
asset_content_type: application/zip
- name: Upload Zipped Windows Artifact to Release
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/unearth-${{ steps.version_info.outputs.FULL_VERSION }}-windows.zip
asset_name: unearth-${{ steps.version_info.outputs.FULL_VERSION }}-windows.zip
asset_content_type: application/zip