fix(release): support prerelease adaptation packs
Adaptation pack / release (push) Canceled after 0s
Adaptation pack / release (push) Canceled after 0s
Include published prereleases in adaptation pack checks. Publish signed adaptation packs as prereleases and let manual workflow runs stage a draft for release notes.
This commit is contained in:
1 parent
01f7b5769b
commit
bd7450d9a1
2 files changed
+14
-3
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
# Release an adaptation pack (packages/patcher/src/patch-pack/): pack and sign patches/ and publish
|
# Release an adaptation pack (packages/patcher/src/patch-pack/): pack and sign patches/ and publish
|
||||||
# it as a GitHub release tagged patches-<version>, where the launcher looks for it.
|
# it as a GitHub prerelease tagged patches-<version>, where the launcher looks for it.
|
||||||
#
|
#
|
||||||
# Start it either way:
|
# Start it either way:
|
||||||
# - push a tag: git tag patches-2026.11.29 && git push origin patches-2026.11.29
|
# - push a tag: git tag patches-2026.11.29 && git push origin patches-2026.11.29
|
||||||
@@ -18,6 +18,10 @@ on:
|
|||||||
description: 'Pack version, YYYY.MM.DD or YYYY.MM.DD.N'
|
description: 'Pack version, YYYY.MM.DD or YYYY.MM.DD.N'
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
draft:
|
||||||
|
description: 'Keep the signed prerelease as a draft for editing before publication'
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -50,19 +54,25 @@ jobs:
|
|||||||
node scripts/build-patch-pack.ts --out dist
|
node scripts/build-patch-pack.ts --out dist
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Publish the release
|
- name: Create the prerelease
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
DRAFT: ${{ inputs.draft || false }}
|
||||||
run: |
|
run: |
|
||||||
manifest=$(ls dist/*.manifest.json)
|
manifest=$(ls dist/*.manifest.json)
|
||||||
field() { node -e "const m=JSON.parse(require('fs').readFileSync(process.argv[1],'utf8'));const v=m[process.argv[2]];process.stdout.write(Array.isArray(v)?v.join(', '):String(v))" "$manifest" "$1"; }
|
field() { node -e "const m=JSON.parse(require('fs').readFileSync(process.argv[1],'utf8'));const v=m[process.argv[2]];process.stdout.write(Array.isArray(v)?v.join(', '):String(v))" "$manifest" "$1"; }
|
||||||
version=$(field version)
|
version=$(field version)
|
||||||
printf 'Adaptation pack %s.\n\nChecked game versions: %s\nNeeds offline version %s or newer.\n' \
|
printf 'Adaptation pack %s.\n\nChecked game versions: %s\nNeeds offline version %s or newer.\n' \
|
||||||
"$version" "$(field game_versions)" "$(field min_app_version)" > dist/notes.md
|
"$version" "$(field game_versions)" "$(field min_app_version)" > dist/notes.md
|
||||||
|
release_flags=(--prerelease)
|
||||||
|
if [ "$DRAFT" = 'true' ]; then
|
||||||
|
release_flags+=(--draft)
|
||||||
|
fi
|
||||||
gh release create "patches-$version" \
|
gh release create "patches-$version" \
|
||||||
"dist/wtoffline-patches-$version.zip" \
|
"dist/wtoffline-patches-$version.zip" \
|
||||||
"dist/wtoffline-patches-$version.zip.sig" \
|
"dist/wtoffline-patches-$version.zip.sig" \
|
||||||
"dist/wtoffline-patches-$version.manifest.json" \
|
"dist/wtoffline-patches-$version.manifest.json" \
|
||||||
|
"${release_flags[@]}" \
|
||||||
--title "Adaptation pack $version" \
|
--title "Adaptation pack $version" \
|
||||||
--notes-file dist/notes.md \
|
--notes-file dist/notes.md \
|
||||||
--target "$GITHUB_SHA"
|
--target "$GITHUB_SHA"
|
||||||
@@ -105,9 +105,10 @@ function collectReleases(
|
|||||||
if (typeof entry !== 'object' || entry === null) continue;
|
if (typeof entry !== 'object' || entry === null) continue;
|
||||||
const release = entry as Record<string, unknown>;
|
const release = entry as Record<string, unknown>;
|
||||||
const tag = release['tag_name'];
|
const tag = release['tag_name'];
|
||||||
if (typeof tag !== 'string' || release['draft'] === true || release['prerelease'] === true) continue;
|
if (typeof tag !== 'string' || release['draft'] === true) continue;
|
||||||
|
|
||||||
if (tag.startsWith('v')) {
|
if (tag.startsWith('v')) {
|
||||||
|
if (release['prerelease'] === true) continue;
|
||||||
const version = AppReleaseVersionSchema.safeParse(tag.slice(1));
|
const version = AppReleaseVersionSchema.safeParse(tag.slice(1));
|
||||||
if (!version.success) continue;
|
if (!version.success) continue;
|
||||||
const launcher = launcherRelease(release, version.data, repository);
|
const launcher = launcherRelease(release, version.data, repository);
|
||||||
|
|||||||
Reference in new issue
Block a user