Skip to content

Commit 3bbfe78

Browse files
committed
Update build.yml
1 parent 19fe6fa commit 3bbfe78

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
103103
runs-on: ubuntu-latest
104104
permissions:
105-
contents: write # needed to publish a Release with GITHUB_TOKEN
105+
contents: write
106106
steps:
107107
- name: Download all packaged artifacts
108108
uses: actions/download-artifact@v4
@@ -131,14 +131,23 @@ jobs:
131131
exit 1
132132
fi
133133
134-
# Rename artifacts to include 'nightly' instead of version
135-
- name: Normalize nightly filenames
134+
# Rename artifacts: replace ONLY the version token between hyphens with 'nightly', keep platform + extension
135+
- name: Normalize nightly filenames (preserve platform + extension)
136136
shell: bash
137137
run: |
138+
set -euo pipefail
138139
shopt -s nullglob
139140
for f in upload/*; do
140141
base="$(basename "$f")"
141-
new="$(echo "$base" | sed -E 's/([0-9]+\.[0-9]+(\.[0-9]+)*([.-][0-9A-Za-z]+)*)/nightly/; s/--/-/g')"
142+
ext=""; stem="$base"
143+
if [[ "$base" == *.* ]]; then
144+
ext=".${base##*.}" # extension incl. dot
145+
stem="${base%.*}" # name without extension
146+
fi
147+
# Replace the first hyphen-delimited numeric version token with 'nightly'
148+
# Example: wurst-compiler-1.8.1.0-linux-x64 -> wurst-compiler-nightly-linux-x64
149+
new_stem="$(echo "$stem" | sed -E 's/-[0-9]+(\.[0-9]+)*-/-nightly-/' )"
150+
new="${new_stem}${ext}"
142151
if [[ "$base" != "$new" ]]; then
143152
mv -f "upload/$base" "upload/$new"
144153
fi
@@ -149,8 +158,8 @@ jobs:
149158
- name: Publish Nightly Release (rolling 'nightly' tag)
150159
uses: softprops/action-gh-release@v2
151160
with:
152-
tag_name: nightly # reuse same tag; no new tag per run
153-
name: Nightly Build (master) # stable title
161+
tag_name: nightly
162+
name: Nightly Build (master)
154163
prerelease: true
155164
draft: false
156165
make_latest: false
@@ -160,6 +169,6 @@ jobs:
160169
This release is automatically updated in-place (same tag).
161170
files: |
162171
upload/**
163-
fail_on_unmatched_files: false # single glob; we've verified both types exist
172+
fail_on_unmatched_files: false
164173
env:
165174
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)