Skip to content

Commit be16578

Browse files
authored
adding more stuff for auto building releases
mobile coding is hell its the only thing i can use though while being on vacation sob i dont wanna stay for too long without doing shits
1 parent e862d72 commit be16578

File tree

1 file changed

+59
-20
lines changed

1 file changed

+59
-20
lines changed

.github/workflows/make-release.yml renamed to .github/workflows/release.yml

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
description: "Is this a prerelease?"
1111
required: true
1212
type: boolean
13+
custom_message:
14+
description: "Optional pre-changelog message"
15+
required: false
1316

1417
jobs:
1518
collect-release:
@@ -36,15 +39,15 @@ jobs:
3639
path: artifacts/windows/executable
3740
allow_forks: false
3841

39-
- name: Download macOS Full Build
42+
- name: Download Mac OS Full Build
4043
uses: dawidd6/action-download-artifact@v6
4144
with:
4245
workflow: macos.yml
4346
name: Codename Engine
4447
path: artifacts/macos/full_build
4548
allow_forks: false
4649

47-
- name: Download macOS Executable
50+
- name: Download Mac OS Executable
4851
uses: dawidd6/action-download-artifact@v6
4952
with:
5053
workflow: macos.yml
@@ -78,7 +81,7 @@ jobs:
7881
zip -r ../../../renamed/"Codename Engine-Windows.zip" *
7982
cd -
8083
81-
# macOS
84+
# Mac OS
8285
mv artifacts/macos/executable/CodenameEngine renamed/update-mac
8386
cd artifacts/macos/full_build
8487
if [ -f CodenameEngine.tar.gz ]; then
@@ -109,7 +112,7 @@ jobs:
109112
-L 50 -q '.[] | select(.isPrerelease==false and .isDraft==false) | .tagName' | head -n 1)
110113
111114
if [ -z "$BASE" ]; then
112-
echo "No stable release found, resorting to prereleases"
115+
echo "No stable release found, resorting to prereleases."
113116
BASE=$(gh release list --repo ${{ github.repository }} --json tagName,isDraft \
114117
-L 1 -q '.[] | select(.isDraft==false) | .tagName')
115118
fi
@@ -118,24 +121,59 @@ jobs:
118121
-L 50 -q '.[] | select(.isPrerelease==false and .isDraft==false) | .tagName' | head -n 1)
119122
fi
120123
121-
echo "Base release: $BASE"
122-
echo "base_release=$BASE" >> $GITHUB_OUTPUT
124+
if [ -z "$BASE" ]; then
125+
echo "No older release found; please make sure to have at least one older release containing the 'update-assets.zip' file in order to generate the differences."
126+
exit 1
127+
else
128+
echo "Base release: $BASE"
129+
echo "base_release=$BASE" >> $GITHUB_OUTPUT
130+
fi
123131
124132
- name: Prepare update-assets.zip
125133
env:
126134
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127135
run: |
128-
mkdir -p update_assets_temp renamed
129-
echo "Downloading assets from release ${{ steps.get_base_release.outputs.base_release }}"
130-
gh release download "${{ steps.get_base_release.outputs.base_release }}" \
131-
--repo ${{ github.repository }} \
132-
--pattern "update-assets.zip" \
133-
-D update_assets_temp
134-
135-
unzip -q update_assets_temp/update-assets.zip -d update_assets_temp
136-
cd update_assets_temp
137-
zip -r ../renamed/update-assets.zip assets
138-
cd ..
136+
echo "Looking for 'update-assets.zip' from release '${{ steps.get_base_release.outputs.base_release }}'"
137+
ASSETS=$(gh release view "${{ steps.get_base_release.outputs.base_release }}" \
138+
--repo "${{ github.repository }}" \
139+
--json assets \
140+
| jq -r '.assets[].name')
141+
142+
if echo "$ASSETS" | grep -xq "update-assets.zip"; then
143+
mkdir -p update_assets_temp renamed
144+
echo "Downloading assets from release '${{ steps.get_base_release.outputs.base_release }}'"
145+
gh release download "${{ steps.get_base_release.outputs.base_release }}" \
146+
--repo ${{ github.repository }} \
147+
--pattern "update-assets.zip" \
148+
-D update_assets_temp
149+
150+
unzip -q update_assets_temp/update-assets.zip -d update_assets_temp
151+
cd update_assets_temp
152+
zip -r ../renamed/update-assets.zip . -i assets
153+
else
154+
echo "No 'update-assets.zip' file found in release '${{ steps.get_base_release.outputs.base_release }}'; please make sure to have this file in that older release in order to generate the differences."
155+
exit 1
156+
fi
157+
158+
- name: Prepare pre-changelog message
159+
id: pre_changelog_message
160+
env:
161+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
162+
run: |
163+
echo "Preparing a pre-changelog message..."
164+
165+
BODY="If you would like to download the full builds of the engine from this release, please ignore the files starting with 'update-' as they're needed for the engine's internal autoupdater.\n\n"
166+
167+
if [ -n "${{ github.event.inputs.custom_message }}" ]; then
168+
BODY="${{ github.event.inputs.custom_message }}\n${BODY}"
169+
fi
170+
171+
{
172+
echo "body<<EOF"
173+
echo -e "$BODY"
174+
echo "EOF"
175+
} >> $GITHUB_OUTPUT
176+
echo -e "Final pre-changelog message:\n\n$BODY"
139177
140178
- name: Create GitHub Release with Assets
141179
uses: softprops/action-gh-release@v1
@@ -146,13 +184,14 @@ jobs:
146184
name: Release ${{ github.event.inputs.tag_name }}
147185
draft: true
148186
prerelease: ${{ github.event.inputs.prerelease }}
187+
body: ${{ steps.build_body.outputs.body }}
149188
generate_release_notes: true
150189
files: |
151190
renamed/Codename Engine-Windows.zip
152-
renamed/update-windows.exe
153191
renamed/Codename Engine-Mac.zip
154192
renamed/Codename Engine-Mac.tar.gz
155-
renamed/update-mac
156193
renamed/Codename Engine-Linux.zip
157-
renamed/update-linux
158194
renamed/update-assets.zip
195+
renamed/update-windows.exe
196+
renamed/update-mac
197+
renamed/update-linux

0 commit comments

Comments
 (0)