@@ -102,51 +102,73 @@ 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
108- # grabs every artifact your matrix uploaded (keeps your names)
109108 uses : actions/download-artifact@v4
110109 with :
111110 path : artifacts
112111
113- - name : Gather files
112+ # Copy only archives (skip .sha256 for nightly)
113+ - name : Gather files (zip + tar.gz, no checksums)
114114 shell : bash
115115 run : |
116+ set -euo pipefail
116117 mkdir -p upload
117- # pick up what your existing packaging already produced
118- find artifacts -type f \( -name '*.zip' -o -name '*.tar.gz' -o -name '*.sha256' \) -print0 | xargs -0 -I{} cp "{}" upload/
118+ find artifacts -type f \( -name '*.zip' -o -name '*.tar.gz' \) -print0 | xargs -0 -I{} cp "{}" upload/
119119
120- - name : Normalize nightly filenames
120+ # Ensure both Windows (.zip) and Linux (.tar.gz) exist
121+ - name : Verify we have both archive types
122+ shell : bash
123+ run : |
124+ shopt -s nullglob
125+ zips=(upload/*.zip)
126+ tars=(upload/*.tar.gz)
127+ echo "Found ${#zips[@]} zip(s) and ${#tars[@]} tar.gz file(s)."
128+ if (( ${#zips[@]} == 0 || ${#tars[@]} == 0 )); then
129+ echo "ERROR: Expected both .zip (Windows) and .tar.gz (Linux) artifacts."
130+ ls -alR upload || true
131+ exit 1
132+ fi
133+
134+ # Rename artifacts: replace ONLY the version token between hyphens with 'nightly', keep platform + extension
135+ - name : Normalize nightly filenames (preserve platform + extension)
121136 shell : bash
122137 run : |
123- # Copy artifacts into ./upload first (keep your existing step if you already do this)
124- # Then rename: replace the first version-looking token with 'nightly'
138+ set -euo pipefail
125139 shopt -s nullglob
126140 for f in upload/*; do
127141 base="$(basename "$f")"
128- new="$(echo "$base" | sed -E 's/([0-9]+\.[0-9]+(\.[0-9]+)*([.-][0-9A-Za-z]+)*)/nightly/; s/--/-/g')"
129- # only rename if it actually changed and if it won't overwrite a different file type
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}"
130151 if [[ "$base" != "$new" ]]; then
131152 mv -f "upload/$base" "upload/$new"
132153 fi
133154 done
155+ echo "After rename:"
156+ ls -alh upload
134157
135- - name : Publish Nightly Release
158+ - name : Publish Nightly Release (rolling 'nightly' tag)
136159 uses : softprops/action-gh-release@v2
137160 with :
138- tag_name : nightly-master
161+ tag_name : nightly
139162 name : Nightly Build (master)
140163 prerelease : true
141164 draft : false
142165 make_latest : false
143166 generate_release_notes : false
144167 body : |
145168 Nightly build for the latest commit on `master`.
169+ This release is automatically updated in-place (same tag).
146170 files : |
147- upload/*.zip
148- upload/*.tar.gz
149- upload/*.sha256
150- fail_on_unmatched_files : true
171+ upload/**
172+ fail_on_unmatched_files : false
151173 env :
152- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
174+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments