|
95 | 95 | de.peeeq.wurstscript/build/releases/*.sha256 |
96 | 96 | if-no-files-found: error |
97 | 97 | retention-days: 7 |
| 98 | + |
| 99 | + nightly_release: |
| 100 | + name: Nightly prerelease (master) |
| 101 | + needs: build |
| 102 | + if: github.ref == 'refs/heads/master' && github.event_name == 'push' |
| 103 | + runs-on: ubuntu-latest |
| 104 | + permissions: |
| 105 | + contents: write |
| 106 | + steps: |
| 107 | + - name: Download all packaged artifacts |
| 108 | + uses: actions/download-artifact@v4 |
| 109 | + with: |
| 110 | + path: artifacts |
| 111 | + |
| 112 | + # Copy only archives (skip .sha256 for nightly) |
| 113 | + - name: Gather files (zip + tar.gz, no checksums) |
| 114 | + shell: bash |
| 115 | + run: | |
| 116 | + set -euo pipefail |
| 117 | + mkdir -p upload |
| 118 | + find artifacts -type f \( -name '*.zip' -o -name '*.tar.gz' \) -print0 | xargs -0 -I{} cp "{}" upload/ |
| 119 | +
|
| 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) |
| 136 | + shell: bash |
| 137 | + run: | |
| 138 | + set -euo pipefail |
| 139 | + shopt -s nullglob |
| 140 | + for f in upload/*; do |
| 141 | + base="$(basename "$f")" |
| 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}" |
| 151 | + if [[ "$base" != "$new" ]]; then |
| 152 | + mv -f "upload/$base" "upload/$new" |
| 153 | + fi |
| 154 | + done |
| 155 | + echo "After rename:" |
| 156 | + ls -alh upload |
| 157 | +
|
| 158 | + - name: Publish Nightly Release (rolling 'nightly' tag) |
| 159 | + uses: softprops/action-gh-release@v2 |
| 160 | + with: |
| 161 | + tag_name: nightly |
| 162 | + name: Nightly Build (master) |
| 163 | + prerelease: true |
| 164 | + draft: false |
| 165 | + make_latest: false |
| 166 | + generate_release_notes: false |
| 167 | + body: | |
| 168 | + Nightly build for the latest commit on `master`. |
| 169 | + This release is automatically updated in-place (same tag). |
| 170 | + files: | |
| 171 | + upload/** |
| 172 | + fail_on_unmatched_files: false |
| 173 | + env: |
| 174 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments