-
Notifications
You must be signed in to change notification settings - Fork 2
169 lines (138 loc) · 6.09 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
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
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-mac:
runs-on: macos-latest
steps:
# See https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
- name: Install Apple codesigning certificate
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_CODESIGNING_CERTIFICATE }}
P12_PASSWORD: ${{ secrets.APPLE_CODESIGNING_P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Install Godot
working-directory: ${{ env.RUNNER_TEMP }}
run: |
curl -sL https://github.com/godotengine/godot/releases/download/4.2.2-stable/Godot_v4.2.2-stable_macos.universal.zip -o godot.zip
unzip godot.zip
mv Godot.app "$RUNNER_TEMP/Godot.app"
- name: Install butler
working-directory: ${{ env.RUNNER_TEMP }}
run: |
curl -sL https://broth.itch.ovh/butler/darwin-amd64/LATEST/archive/default -o butler.zip
unzip butler.zip
mv butler "$RUNNER_TEMP/butler"
- uses: actions/checkout@v4
- name: Prepare export templates
run: |
mkdir -p ~/Library/Application\ Support/Godot/export_templates/4.2.2.stable
mv build/export_templates/* ~/Library/Application\ Support/Godot/export_templates/4.2.2.stable/
- name: Cache .godot
uses: actions/cache@v4
with:
path: .godot
key: dot-godot-${{ runner.os }}
restore-keys: dot-godot-
- name: Export build
env:
GODOT_MACOS_NOTARIZATION_API_UUID: ${{ secrets.APPLE_NOTARY_ISSUER_ID }}
GODOT_MACOS_NOTARIZATION_API_KEY_ID: ${{ secrets.APPLE_NOTARY_KEY_ID }}
APPLE_NOTARY_PRIVATE_KEY: ${{ secrets.APPLE_NOTARY_PRIVATE_KEY }}
run: |
PRIVATE_KEY_FILE=$RUNNER_TEMP/notary_private_key.p8
echo -n "$APPLE_NOTARY_PRIVATE_KEY" > "$PRIVATE_KEY_FILE"
(GODOT_MACOS_NOTARIZATION_API_KEY="$PRIVATE_KEY_FILE" "$RUNNER_TEMP/Godot.app/Contents/MacOS/Godot" --headless --export-release macOS 2>&1) | tee build.log
echo "Waiting for notarization…"
NOTARIZATION_REQUEST_UUID=$(awk -F'"' '/Notarization request UUID:/ {print $2}' build.log)
xcrun notarytool wait --key "$PRIVATE_KEY_FILE" --key-id "$GODOT_MACOS_NOTARIZATION_API_KEY_ID" --issuer "$GODOT_MACOS_NOTARIZATION_API_UUID" "$NOTARIZATION_REQUEST_UUID"
echo "Stapling notarization ticket"
unzip build/mac.zip -d $RUNNER_TEMP
xcrun stapler staple $RUNNER_TEMP/Merc.app
- name: Push to itch.io
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
run: |
"$RUNNER_TEMP/butler" push $RUNNER_TEMP/Merc.app "jspahrsummers/Merc:mac"
build-windows:
runs-on: ubuntu-latest
steps:
- name: Install Godot
working-directory: ${{ env.RUNNER_TEMP }}
run: |
curl -sL https://github.com/godotengine/godot/releases/download/4.2.2-stable/Godot_v4.2.2-stable_linux.x86_64.zip -o godot.zip
unzip godot.zip
mv Godot_v4.2.2-stable_linux.x86_64 "$RUNNER_TEMP/godot"
- name: Install butler
working-directory: ${{ env.RUNNER_TEMP }}
run: |
curl -sL https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default -o butler.zip
unzip butler.zip
mv butler "$RUNNER_TEMP/butler"
- uses: actions/checkout@v4
- name: Prepare export templates
run: |
mkdir -p ~/.local/share/godot/export_templates/4.2.2.stable
mv build/export_templates/* ~/.local/share/godot/export_templates/4.2.2.stable/
- name: Cache .godot
uses: actions/cache@v4
with:
path: .godot
key: dot-godot-${{ runner.os }}
restore-keys: dot-godot-
- name: Export build
run: |
"$RUNNER_TEMP/godot" --headless --export-release Windows
- name: Push to itch.io
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
run: |
"$RUNNER_TEMP/butler" push build/Windows "jspahrsummers/Merc:windows"
post-on-discord:
needs: [build-mac, build-windows]
if: ${{ !contains(github.event.head_commit.message, '@skip-notify') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
requirements.txt
script/
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Generate changelog
id: changelog
run: |
echo "changelog<<EOF" >> "$GITHUB_OUTPUT"
python ./script/markdown_changelog.py >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: tsickert/discord-webhook@v6.0.0
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
content: |
New build available! Get it from: <https://jspahrsummers.itch.io/merc>
${{ steps.changelog.outputs.changelog }}