-
-
Notifications
You must be signed in to change notification settings - Fork 3
245 lines (215 loc) · 7.25 KB
/
nightly_release.yml
File metadata and controls
245 lines (215 loc) · 7.25 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# Release workflow for myMCpp (on each push to master).
# Inspired by PCSX2's release workflow.
name: 🌙 Nightly Builds
on:
push:
branches:
- master
permissions:
contents: write
jobs:
cut_release:
if: github.repository == 'PCSX2/myMCpp'
name: 'Create tag and draft release'
runs-on: ubuntu-latest
outputs:
new_tag: ${{ steps.release_meta.outputs.new_tag }}
release_name: ${{ steps.release_meta.outputs.release_name }}
steps:
- uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- name: Tag, notes, and draft release
id: release_meta
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
set -euo pipefail
git fetch --tags --no-recurse-submodules
SHA="${{ github.sha }}"
DATE="$(date -u +'%Y%m%d')"
TAG="nightly-${DATE}"
NAME="myMCpp Nightly ${DATE}"
PRERELEASE=true
gh release delete "$TAG" --yes 2>/dev/null || true
git push origin ":refs/tags/$TAG" 2>/dev/null || true
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git tag -fa "$TAG" -m "$NAME" "$SHA"
git push -f origin "refs/tags/$TAG"
gh api "repos/${{ github.repository }}/releases/generate-notes" \
-f tag_name="$TAG" \
-f target_commitish="$SHA" \
--jq .body > "$GITHUB_WORKSPACE/release-notes.md"
gh release delete "$TAG" --yes 2>/dev/null || true
EXTRA=""
if [ "$PRERELEASE" = true ]; then EXTRA="--prerelease"; fi
gh release create "$TAG" \
--draft \
$EXTRA \
--title "$NAME" \
--notes-file "$GITHUB_WORKSPACE/release-notes.md" \
--target "$SHA"
echo "new_tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "release_name=${NAME}" >> "$GITHUB_OUTPUT"
build_linux_clang:
if: github.repository == 'PCSX2/myMCpp'
name: '🐧 Linux (Clang, Nightly)'
needs: cut_release
uses: ./.github/workflows/linux_build.yml
with:
jobName: 'Linux Clang Nightly Build'
artifactPrefixName: 'myMCpp-nightly-linux-x64-clang'
compiler: clang
fetchTags: true
secrets: inherit
build_linux_gcc:
if: github.repository == 'PCSX2/myMCpp'
name: '🐧 Linux (GCC, Nightly)'
needs: cut_release
uses: ./.github/workflows/linux_build.yml
with:
jobName: 'Linux GCC Nightly Build'
artifactPrefixName: 'myMCpp-nightly-linux-x64-gcc'
compiler: gcc
fetchTags: true
secrets: inherit
build_macos:
if: github.repository == 'PCSX2/myMCpp'
name: '🍎 macOS (Nightly)'
needs: cut_release
uses: ./.github/workflows/macos_build.yml
with:
jobName: 'macOS Nightly Build'
artifactPrefixName: 'myMCpp-nightly-macos-universal'
fetchTags: true
secrets: inherit
build_windows_x64_clang:
if: github.repository == 'PCSX2/myMCpp'
name: '🪟 Windows x64 (Clang, Nightly)'
needs: cut_release
uses: ./.github/workflows/windows_build.yml
with:
jobName: 'Windows x64 Clang Nightly Build'
artifactPrefixName: 'myMCpp-nightly-windows-x64-clang'
platform: x64
compiler: clang
fetchTags: true
secrets: inherit
build_windows_x64_msvc:
if: github.repository == 'PCSX2/myMCpp'
name: '🪟 Windows x64 (MSVC, Nightly)'
needs: cut_release
uses: ./.github/workflows/windows_build.yml
with:
jobName: 'Windows x64 MSVC Nightly Build'
artifactPrefixName: 'myMCpp-nightly-windows-x64-msvc'
platform: x64
compiler: msvc
fetchTags: true
secrets: inherit
build_windows_arm64_clang:
if: github.repository == 'PCSX2/myMCpp'
name: '🪟 Windows ARM64 (Clang, Nightly)'
needs: cut_release
uses: ./.github/workflows/windows_build.yml
with:
jobName: 'Windows ARM64 Clang Nightly Build'
artifactPrefixName: 'myMCpp-nightly-windows-arm64-clang'
os: windows-11-arm
platform: ARM64
compiler: clang
fetchTags: true
secrets: inherit
build_windows_arm64_msvc:
if: github.repository == 'PCSX2/myMCpp'
name: '🪟 Windows ARM64 (MSVC, Nightly)'
needs: cut_release
uses: ./.github/workflows/windows_build.yml
with:
jobName: 'Windows ARM64 MSVC Nightly Build'
artifactPrefixName: 'myMCpp-nightly-windows-arm64-msvc'
os: windows-11-arm
platform: ARM64
compiler: msvc
fetchTags: true
secrets: inherit
upload_and_publish:
if: github.repository == 'PCSX2/myMCpp'
name: '📦 Upload assets and publish release'
runs-on: ubuntu-latest
needs:
- cut_release
- build_linux_clang
- build_linux_gcc
- build_macos
- build_windows_x64_clang
- build_windows_x64_msvc
- build_windows_arm64_clang
- build_windows_arm64_msvc
steps:
- uses: actions/checkout@v6.0.2
- name: Download all artifacts
uses: actions/download-artifact@v8.0.1
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -R artifacts/
- name: Prepare release assets
shell: bash
env:
TAG: ${{ needs.cut_release.outputs.new_tag }}
run: |
set -euo pipefail
mkdir -p release-assets
for dir in artifacts/*/; do
dirname="$(basename "$dir")"
if [[ "$dirname" == *"-symbols" ]]; then
continue
fi
echo "Processing: $dirname"
if [[ "$dirname" == *"windows"* ]]; then
asset_name="myMCpp-${TAG}-${dirname#myMCpp-nightly-}.zip"
echo " -> Creating $asset_name"
(cd "$dir" && zip -r "../../release-assets/$asset_name" ./*)
elif [[ "$dirname" == *"macos"* ]]; then
for f in "$dir"*.tar.xz; do
if [ -f "$f" ]; then
asset_name="myMCpp-${TAG}-${dirname#myMCpp-nightly-}.tar.xz"
echo " -> Moving to $asset_name"
cp "$f" "release-assets/$asset_name"
fi
done
elif [[ "$dirname" == *"linux"* ]]; then
for f in "$dir"*.AppImage; do
if [ -f "$f" ]; then
asset_name="myMCpp-${TAG}-${dirname#myMCpp-nightly-}.AppImage"
echo " -> Moving to $asset_name"
cp "$f" "release-assets/$asset_name"
fi
done
fi
done
echo ""
echo "=== Final release assets ==="
ls -la release-assets/
- name: Upload release assets
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ needs.cut_release.outputs.new_tag }}
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
files=(release-assets/*)
if [ ${#files[@]} -eq 0 ]; then
echo "No release assets to upload."
exit 1
fi
gh release upload "$TAG" "${files[@]}" --clobber
- name: Publish release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ needs.cut_release.outputs.new_tag }}
run: gh release edit "$TAG" --draft=false