Skip to content

Commit 5f96af8

Browse files
committed
Package all releases as .zip (#1102)
1 parent 691fdf2 commit 5f96af8

File tree

3 files changed

+10
-57
lines changed

3 files changed

+10
-57
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
# ---- FAIL FAST: package first (so jlink issues show immediately) ----
8080
- name: Package slim runtime (fail fast)
8181
shell: bash
82-
run: ./gradlew checksumSlimCompilerDist --no-daemon --stacktrace
82+
run: ./gradlew packageSlimCompilerDist --no-daemon --stacktrace
8383

8484
- name: Run tests
8585
shell: bash
@@ -123,10 +123,9 @@ jobs:
123123
run: |
124124
shopt -s nullglob
125125
zips=(upload/*.zip)
126-
tars=(upload/*.tar.gz)
127126
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."
127+
if (( ${#zips[@]} != 2 )); then
128+
echo "ERROR: Expected both .zip (Windows) and .zip (Linux) artifacts."
130129
ls -alR upload || true
131130
exit 1
132131
fi

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555

5656
# Build fat jar + jdeps + jlink + package + checksum for this OS
5757
- name: Package slim runtime (per-OS)
58-
run: ./gradlew --no-daemon --stacktrace checksumSlimCompilerDist
58+
run: ./gradlew --no-daemon --stacktrace packageSlimCompilerDist
5959

6060
- name: Upload to GitHub Release
6161
uses: softprops/action-gh-release@v2

de.peeeq.wurstscript/deploy.gradle

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -177,70 +177,24 @@ tasks.named("assembleSlimCompilerDist", Copy) { t ->
177177
}
178178
}
179179

180-
// 4a) Package ZIP on Windows
180+
// 4) Package ZIP on all platforms
181181
tasks.register("packageSlimCompilerDistZip", Zip) {
182-
description = "Packages slim dist as a ZIP archive (Windows)."
182+
description = "Packages slim dist as a ZIP archive (all platforms)."
183183
group = "distribution"
184-
enabled = os.isWindows()
185-
184+
enabled = true
186185
dependsOn("assembleSlimCompilerDist")
187186

188187
from(distRoot)
189188
destinationDirectory.set(releasesDir)
190189
archiveFileName.set("wurst-compiler-${project.version}-${plat}.zip")
191190
}
192191

193-
// 4b) Package tar.gz on Linux/macOS
194-
tasks.register("packageSlimCompilerDistTar", Tar) {
195-
description = "Packages slim dist as a tar.gz archive (Linux/macOS)."
196-
group = "distribution"
197-
enabled = !os.isWindows()
198-
199-
dependsOn("assembleSlimCompilerDist")
200-
201-
from(distRoot)
202-
destinationDirectory.set(releasesDir)
203-
compression = Compression.GZIP
204-
archiveExtension.set("tar.gz")
205-
archiveFileName.set("wurst-compiler-${project.version}-${plat}.tar.gz")
206-
}
207-
208-
// 4c) OS-aware convenience wrapper
192+
// OS-aware convenience wrapper now just points to ZIP
209193
tasks.register("packageSlimCompilerDist") {
210-
description = "Packages slim dist for the current platform (zip on Windows, tar.gz elsewhere)."
194+
description = "Packages slim dist for the current platform (ZIP on all OSes)."
211195
group = "distribution"
212-
dependsOn(os.isWindows() ? "packageSlimCompilerDistZip" : "packageSlimCompilerDistTar")
196+
dependsOn("packageSlimCompilerDistZip")
213197
}
214198

215-
// 5) SHA-256 checksum for the packaged archive
216-
tasks.register("checksumSlimCompilerDist") {
217-
description = "Writes SHA-256 alongside the packaged archive."
218-
group = "distribution"
219-
dependsOn("packageSlimCompilerDist")
220-
221-
outputs.upToDateWhen { false }
222-
223-
doLast {
224-
def outDir = releasesDir.get().asFile
225-
def expectedZip = new File(outDir, "wurst-compiler-${project.version}-${plat}.zip")
226-
def expectedTarGz = new File(outDir, "wurst-compiler-${project.version}-${plat}.tar.gz")
227-
def archFile = expectedZip.exists() ? expectedZip : (expectedTarGz.exists() ? expectedTarGz : null)
228-
if (archFile == null) throw new GradleException("Archive not found in ${outDir}")
229-
230-
def md = java.security.MessageDigest.getInstance("SHA-256")
231-
archFile.withInputStream { is ->
232-
byte[] buf = new byte[8192]
233-
for (int r = is.read(buf); r != -1; r = is.read(buf)) {
234-
md.update(buf, 0, r)
235-
}
236-
}
237-
def hex = md.digest().collect { String.format("%02x", it) }.join()
238-
def sumFile = new File(outDir, archFile.name + ".sha256")
239-
sumFile.text = "${hex} ${archFile.name}\n"
240-
241-
logger.lifecycle("[sha256] ${sumFile.name} -> ${hex}")
242-
logger.lifecycle("[release] Upload: ${archFile.absolutePath}")
243-
}
244-
}
245199

246200

0 commit comments

Comments
 (0)