diff --git a/.github/workflows/patch-pack.yml b/.github/workflows/patch-pack.yml index f15f326..32dc233 100644 --- a/.github/workflows/patch-pack.yml +++ b/.github/workflows/patch-pack.yml @@ -1,5 +1,5 @@ # Release an adaptation pack (packages/patcher/src/patch-pack/): pack and sign patches/ and publish -# it as a GitHub release tagged patches-, where the launcher looks for it. +# it as a GitHub prerelease tagged patches-, where the launcher looks for it. # # Start it either way: # - 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' required: true type: string + draft: + description: 'Keep the signed prerelease as a draft for editing before publication' + type: boolean + default: false permissions: contents: write @@ -50,19 +54,25 @@ jobs: node scripts/build-patch-pack.ts --out dist fi - - name: Publish the release + - name: Create the prerelease env: GH_TOKEN: ${{ github.token }} + DRAFT: ${{ inputs.draft || false }} run: | 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"; } version=$(field version) 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 + release_flags=(--prerelease) + if [ "$DRAFT" = 'true' ]; then + release_flags+=(--draft) + fi gh release create "patches-$version" \ "dist/wtoffline-patches-$version.zip" \ "dist/wtoffline-patches-$version.zip.sig" \ "dist/wtoffline-patches-$version.manifest.json" \ + "${release_flags[@]}" \ --title "Adaptation pack $version" \ --notes-file dist/notes.md \ --target "$GITHUB_SHA" diff --git a/apps/launcher/src/main/services/patch-pack/release-feed.ts b/apps/launcher/src/main/services/patch-pack/release-feed.ts index 5841fdb..acd309c 100644 --- a/apps/launcher/src/main/services/patch-pack/release-feed.ts +++ b/apps/launcher/src/main/services/patch-pack/release-feed.ts @@ -105,9 +105,10 @@ function collectReleases( if (typeof entry !== 'object' || entry === null) continue; const release = entry as Record; 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 (release['prerelease'] === true) continue; const version = AppReleaseVersionSchema.safeParse(tag.slice(1)); if (!version.success) continue; const launcher = launcherRelease(release, version.data, repository);