@@ -109,65 +109,90 @@ jobs:
109109 with :
110110 path : artifacts
111111
112- # Copy only archives (skip .sha256 for nightly )
113- - name : Gather files (zip + tar.gz, no checksums )
112+ # Gather only zips (we standardized on .zip across OSes )
113+ - name : Gather files (zip only )
114114 shell : bash
115115 run : |
116116 set -euo pipefail
117117 mkdir -p upload
118- find artifacts -type f \( -name '*.zip' -o -name '*.tar.gz' \) -print0 | xargs -0 -I{} cp "{}" upload/
118+ find artifacts -type f -name '*.zip' -print0 | xargs -0 -I{} cp "{}" upload/
119119
120- # Ensure both Windows (.zip) and Linux (.tar.gz) exist
121- - name : Verify we have both archive types
120+ - name : Verify we have both platform zips
122121 shell : bash
123122 run : |
124123 shopt -s nullglob
125124 zips=(upload/*.zip)
126- echo "Found ${#zips[@]} zip(s) and ${#tars[@]} tar.gz file(s)."
127- if (( ${#zips[@]} != 2 )); then
128- echo "ERROR: Expected both .zip (Windows) and .zip (Linux) artifacts."
129- ls -alR upload || true
125+ echo "Found ${#zips[@]} zip(s):"; ls -alh upload
126+ if (( ${#zips[@]} < 2 )); then
127+ echo "ERROR: expected at least Win + Linux zips."
130128 exit 1
131129 fi
132130
133- # Rename artifacts: replace ONLY the version token between hyphens with ' nightly', keep platform + extension
134- - name : Normalize nightly filenames (preserve platform + extension)
131+ # Normalize filenames to ...- nightly-<plat>.zip
132+ - name : Normalize nightly filenames
135133 shell : bash
136134 run : |
137135 set -euo pipefail
138136 shopt -s nullglob
139- for f in upload/*; do
137+ for f in upload/*.zip ; do
140138 base="$(basename "$f")"
141- ext=""; stem="$base"
142- if [[ "$base" == *.* ]]; then
143- ext=".${base##*.}" # extension incl. dot
144- stem="${base%.*}" # name without extension
145- fi
146- # Replace the first hyphen-delimited numeric version token with 'nightly'
147- # Example: wurst-compiler-1.8.1.0-linux-x64 -> wurst-compiler-nightly-linux-x64
139+ stem="${base%.zip}"
148140 new_stem="$(echo "$stem" | sed -E 's/-[0-9]+(\.[0-9]+)*-/-nightly-/' )"
149- new="${new_stem}${ext}"
150- if [[ "$base" != "$new" ]]; then
151- mv -f "upload/$base" "upload/$new"
152- fi
141+ new="upload/${new_stem}.zip"
142+ if [[ "upload/$base" != "$new" ]]; then mv -f "upload/$base" "$new"; fi
153143 done
154- echo "After rename:"
155- ls -alh upload
144+ echo "Renamed to:"; ls -alh upload
156145
157- - name : Publish Nightly Release (rolling 'nightly' tag)
146+ # --- Key change: recreate rolling 'nightly' release at HEAD ---
147+ - name : Recreate nightly release and tag at HEAD
148+ uses : actions/github-script@v7
149+ with :
150+ script : |
151+ const owner = context.repo.owner;
152+ const repo = context.repo.repo;
153+ const tag = 'nightly';
154+
155+ // Delete existing release (if any)
156+ try {
157+ const { data: rel } = await github.rest.repos.getReleaseByTag({ owner, repo, tag });
158+ await github.rest.repos.deleteRelease({ owner, repo, release_id: rel.id });
159+ core.info(`Deleted release id=${rel.id}`);
160+ } catch (e) {
161+ core.info(`No previous release to delete: ${e.message}`);
162+ }
163+
164+ // Delete/move the tag so we can attach it to HEAD cleanly
165+ try {
166+ await github.rest.git.deleteRef({ owner, repo, ref: `tags/${tag}` });
167+ core.info('Deleted ref tags/nightly');
168+ } catch (e) {
169+ core.info(`No existing tag to delete: ${e.message}`);
170+ }
171+
172+ // Create a fresh prerelease at the current commit
173+ const { data: rel2 } = await github.rest.repos.createRelease({
174+ owner, repo,
175+ tag_name: tag,
176+ target_commitish: process.env.GITHUB_SHA,
177+ name: 'Nightly Build (master)',
178+ body: 'Nightly build for the latest commit on `master`.\nThis release is recreated on each push.',
179+ draft: false,
180+ prerelease: true,
181+ make_latest: false
182+ });
183+ core.setOutput('upload_url', rel2.upload_url);
184+
185+ - name : Publish Nightly Release (upload assets)
158186 uses : softprops/action-gh-release@v2
159187 with :
160188 tag_name : nightly
161- name : Nightly Build (master )
189+ target_commitish : ${{ github.sha }} # will create if missing (but we just created above )
162190 prerelease : true
163191 draft : false
164192 make_latest : false
165193 generate_release_notes : false
166- body : |
167- Nightly build for the latest commit on `master`.
168- This release is automatically updated in-place (same tag).
169- files : |
170- upload/**
194+ files : upload/**
171195 fail_on_unmatched_files : false
172196 env :
173197 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
198+
0 commit comments