diff --git a/.github/MODRINTH.md b/.github/MODRINTH.md index 5d956fed..19539adc 100644 --- a/.github/MODRINTH.md +++ b/.github/MODRINTH.md @@ -1,9 +1,32 @@ -# Copying published releases to Modrinth +# Publishing to Modrinth + +The normal **Release OreSpawn** workflow now publishes to Modrinth automatically +after Maven, CurseForge and GitHub succeed. It uses the original release bundle, +checks it against the GitHub release assets and downloads the public Modrinth +files to verify their checksums. Nothing is rebuilt. The release, beta or alpha +choice applies to CurseForge and Modrinth; GitHub still uses an ordinary release. + +`MODRINTH_TOKEN` is checked with the other credentials before any publication +begins. A missing token stops the release. A Modrinth failure leaves the earlier +publications intact and marks the run as failed; it never replaces their files. +Inspect the logs and receipt before retrying failed jobs, or use the manual copy +workflow below for the same version and channel. Existing identical Modrinth +uploads are verified and reused. + +CurseForge can take time to expose a newly uploaded file publicly. The automatic +job runs only after its upload succeeds, so it checks the original bundle and +GitHub assets rather than waiting for that listing. Its receipt explicitly says +the public CurseForge listing was not checked. Manual backfills still require +matching public CurseForge metadata. + +## Copying an older release Run **Copy published OreSpawn releases to Modrinth** from the MMD repository's Actions page. Enter a published four-part version, or `latest-published` to copy the newest stable OreSpawn 4 release for each Minecraft version and loader. -Tick the confirmation box to publish. The repository needs a `MODRINTH_TOKEN` +For a single version, choose the matching release, beta or alpha channel. +`latest-published` selects stable releases only. Tick the confirmation box to +publish. The repository needs a `MODRINTH_TOKEN` secret with permission to create versions on the MMD OreSpawn project. This workflow downloads existing GitHub release jars, checks their published @@ -23,5 +46,5 @@ against the original release checksums. Its receipt is retained as an Actions artifact. If verification fails after uploading, inspect the receipt and public version before retrying; do not delete or publish another copy blindly. -The normal release workflow is unchanged. For a future release, run this copy -workflow after its GitHub and CurseForge files are public. +Future releases use the normal release workflow; there is no separate Modrinth +step to start by hand. diff --git a/.github/scripts/modrinth-release.mjs b/.github/scripts/modrinth-release.mjs index dd3e33c0..4edf4ed6 100644 --- a/.github/scripts/modrinth-release.mjs +++ b/.github/scripts/modrinth-release.mjs @@ -57,7 +57,7 @@ export function matchingVersion(versions, metadata, hashes) { assert.equal(existing.status, 'listed', 'Existing Modrinth version is not public'); assert.deepEqual(existing.game_versions, [metadata.minecraft], 'Existing Minecraft metadata differs'); assert.deepEqual(existing.loaders, [metadata.loader], 'Existing loader differs'); - assert.equal(existing.version_type, 'release', 'Existing release channel differs'); + assert.equal(existing.version_type, metadata.releaseType ?? 'release', 'Existing release channel differs'); assert.deepEqual(existing.dependencies, [], 'OreSpawn does not require another mod'); assert.equal(existing.files.length, metadata.files.length, 'Existing file set differs'); for (const filename of metadata.files) { @@ -92,15 +92,21 @@ async function output(name, value) { export async function selectVersions() { const requested = process.env.RELEASE_VERSION; + const releaseType = process.env.RELEASE_TYPE || 'release'; + assert.ok(['release', 'beta', 'alpha'].includes(releaseType), 'Invalid release channel'); let versions = [requested]; if (requested === 'latest-published') { + assert.ok(!process.env.RELEASE_ARTIFACT, 'A release bundle can only be used for one explicit version'); + assert.equal(releaseType, 'release', 'Batch backfills select stable releases only'); const releases = []; for (let page = 1; ; page++) { const batch = await json(`https://api.github.com/repos/${repository}/releases?per_page=100&page=${page}`); releases.push(...batch); if (batch.length < 100) break; } - versions = latestPublished(releases); + const widget = await json('https://api.cfwidget.com/245586'); + const stableFiles = new Set(widget.files.filter(file => file.type === 'release').map(file => file.name)); + versions = latestPublished(releases.filter(release => stableFiles.has(`OreSpawn-${release.tag_name}.jar`))); assert.ok(versions.length, 'No published OreSpawn 4 releases found'); } for (const version of versions) assert.match(version, /^4\.\d+\.\d+\.\d+$/); @@ -113,7 +119,7 @@ export function publicCurseForgeFile(files, metadata, mainSize) { const matches = files.filter(file => file.name === metadata.files[0]); assert.equal(matches.length, 1, 'Expected one public CurseForge main file'); const file = matches[0]; - assert.equal(file.type, 'release'); + assert.equal(file.type, metadata.releaseType ?? 'release'); assert.equal(file.filesize, mainSize, 'CurseForge size differs from GitHub'); assert.ok(file.versions.includes(metadata.minecraft), 'CurseForge Minecraft metadata differs'); assert.ok(file.versions.includes(metadata.loader === 'forge' ? 'Forge' : 'NeoForge'), 'CurseForge loader differs'); @@ -124,10 +130,14 @@ export function publicCurseForgeFile(files, metadata, mainSize) { export async function prepare(directory) { const version = process.env.RELEASE_VERSION; assert.match(version ?? '', /^4\.\d+\.\d+\.\d+$/); + const releaseType = process.env.RELEASE_TYPE || 'release'; + assert.ok(['release', 'beta', 'alpha'].includes(releaseType), 'Invalid release channel'); + const preparedArtifact = process.env.RELEASE_ARTIFACT; const release = await json(`https://api.github.com/repos/${repository}/releases/tags/${version}`); assert.ok(!release.draft && !release.prerelease, 'Only published stable releases can be copied'); const source = await json(`https://api.github.com/repos/${repository}/contents/gradle.properties?ref=${version}`); const metadata = releaseMetadata(version, Buffer.from(source.content, 'base64').toString('utf8')); + metadata.releaseType = releaseType; const modrinthProject = await json(`https://api.modrinth.com/v2/project/${project}`); assert.equal(modrinthProject.source_url, `https://github.com/${repository}`); assert.equal(modrinthProject.status, 'approved'); @@ -135,12 +145,17 @@ export async function prepare(directory) { for (const filename of [...metadata.files, 'SHA256SUMS']) { const asset = release.assets.find(asset => asset.name === filename); assert.ok(asset, `Published release is missing ${filename}`); - const response = await fetch(asset.browser_download_url, { signal: AbortSignal.timeout(120000) }); - assert.ok(response.ok, `Published asset download failed: ${filename}`); - const bytes = Buffer.from(await response.arrayBuffer()); + let bytes; + if (preparedArtifact) { + bytes = await readFile(join(directory, filename)); + } else { + const response = await fetch(asset.browser_download_url, { signal: AbortSignal.timeout(120000) }); + assert.ok(response.ok, `Published asset download failed: ${filename}`); + bytes = Buffer.from(await response.arrayBuffer()); + } assert.equal(bytes.length, asset.size, `Published size differs: ${filename}`); if (asset.digest) assert.equal(`sha256:${createHash('sha256').update(bytes).digest('hex')}`, asset.digest); - await writeFile(join(directory, filename), bytes, { flag: 'wx' }); + if (!preparedArtifact) await writeFile(join(directory, filename), bytes, { flag: 'wx' }); } const manifest = await readFile(join(directory, 'SHA256SUMS'), 'utf8'); const hashes = {}; @@ -150,12 +165,18 @@ export async function prepare(directory) { assert.equal(sha256, checksumFor(manifest, filename), `Published SHA256 mismatch: ${filename}`); hashes[filename] = { sha256, sha512: createHash('sha512').update(bytes).digest('hex'), bytes: bytes.length }; } - const widget = await json('https://api.cfwidget.com/245586'); - const curseforge = publicCurseForgeFile(widget.files, metadata, hashes[metadata.files[0]].bytes); + let curseforge; + if (preparedArtifact) { + // The caller has completed the upload; its public listing may still be pending. + curseforge = { uploadCompletedByReleaseWorkflow: true, publicListingChecked: false }; + } else { + const widget = await json('https://api.cfwidget.com/245586'); + curseforge = publicCurseForgeFile(widget.files, metadata, hashes[metadata.files[0]].bytes); + } const existing = await findExistingVersion(metadata, hashes); // Keep the original public notes, including their links and release history. await writeFile(join(directory, 'CHANGELOG.md'), release.body || `[Release notes](${release.html_url})\n`, { flag: 'wx' }); - await writeFile(join(directory, 'modrinth-receipt.json'), JSON.stringify({ metadata, hashes, curseforge, githubRelease: release.html_url, existingVersion: existing?.id }, null, 2)); + await writeFile(join(directory, 'modrinth-receipt.json'), JSON.stringify({ metadata, hashes, curseforge, preparedArtifact, githubRelease: release.html_url, existingVersion: existing?.id }, null, 2)); for (const [name, value] of Object.entries({ name: metadata.name, minecraft: metadata.minecraft, loader: metadata.loader, files: metadata.files.map(file => join(directory, file)).join('\n'), publish: String(!existing), existing_version: existing?.id ?? '' })) await output(name, value); console.log(`${version}: ${existing ? 'identical release already published' : 'published files verified and ready to copy'}`); diff --git a/.github/scripts/modrinth-release.test.mjs b/.github/scripts/modrinth-release.test.mjs index e37c5e6c..a651dc94 100644 --- a/.github/scripts/modrinth-release.test.mjs +++ b/.github/scripts/modrinth-release.test.mjs @@ -1,6 +1,10 @@ import assert from 'node:assert/strict'; +import { createHash } from 'node:crypto'; +import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { dirname, join, resolve } from 'node:path'; import { test } from 'node:test'; -import { checksumFor, findExistingVersion, latestPublished, matchingVersion, publicCurseForgeFile, releaseMetadata } from './modrinth-release.mjs'; +import { checksumFor, findExistingVersion, latestPublished, matchingVersion, prepare, publicCurseForgeFile, releaseMetadata, selectVersions } from './modrinth-release.mjs'; const properties = 'mod_id=orespawn\nmod_version=4.1.1.121012\nminecraft_version=1.21.1\nloader_name=neoforge\ncurseforge_project_id=245586'; const metadata = releaseMetadata('4.1.1.121012', properties); @@ -90,3 +94,131 @@ test('require an exact public CurseForge release with the matching loader, game assert.throws(() => publicCurseForgeFile([{ ...file, versions: ['1.21.1', 'Forge'] }], metadata, 42)); assert.throws(() => publicCurseForgeFile([{ ...file, versions: ['1.21.1', 'Forge', 'NeoForge'] }], metadata, 42)); }); + +for (const channel of ['beta', 'alpha']) test(`preserve the ${channel} channel and reject a conflicting existing channel`, () => { + const expected = { ...metadata, releaseType: channel }; + assert.equal(matchingVersion([{ ...existing, version_type: channel }], expected, hashes).id, existing.id); + assert.throws(() => matchingVersion([existing], expected, hashes)); + const file = { id: 123, name: metadata.files[0], type: channel, filesize: 42, versions: ['1.21.1', 'NeoForge'] }; + assert.equal(publicCurseForgeFile([file], expected, 42).id, 123); +}); + +async function releaseFixture(t, useArtifact = true) { + const directory = await mkdtemp(join(tmpdir(), 'orespawn-modrinth-')); + const saved = Object.fromEntries(['RELEASE_VERSION', 'RELEASE_TYPE', 'RELEASE_ARTIFACT', 'GITHUB_OUTPUT'].map(key => [key, process.env[key]])); + t.after(async () => { + for (const [key, value] of Object.entries(saved)) { + if (value === undefined) delete process.env[key]; + else process.env[key] = value; + } + assert.equal(dirname(directory), resolve(tmpdir())); + await rm(directory, { recursive: true }); + }); + process.env.RELEASE_VERSION = metadata.version; + process.env.RELEASE_TYPE = 'release'; + process.env.RELEASE_ARTIFACT = useArtifact ? 'original-release-bundle' : ''; + delete process.env.GITHUB_OUTPUT; + const payloads = Object.fromEntries(metadata.files.map(filename => [filename, Buffer.from(`published bytes: ${filename}`)])); + const digest = bytes => createHash('sha256').update(bytes).digest('hex'); + payloads.SHA256SUMS = Buffer.from(metadata.files.map(filename => `${digest(payloads[filename])} ${filename}\n`).join('')); + const release = { + tag_name: metadata.version, draft: false, prerelease: false, + body: 'Original public notes.', html_url: 'https://github.com/MinecraftModDevelopmentMods/OreSpawn/releases/example', + assets: Object.entries(payloads).map(([name, bytes]) => ({ name, size: bytes.length, digest: `sha256:${digest(bytes)}`, browser_download_url: `https://downloads.example/${name}` })), + }; + if (useArtifact) for (const [name, bytes] of Object.entries(payloads)) await writeFile(join(directory, name), bytes); + const requested = []; + t.mock.method(globalThis, 'fetch', async url => { + requested.push(url); + if (url.includes('/releases/tags/')) return Response.json(release); + if (url.includes('/contents/gradle.properties')) return Response.json({ content: Buffer.from(properties).toString('base64') }); + if (url.endsWith('/project/cXWN0TpD')) return Response.json({ source_url: 'https://github.com/MinecraftModDevelopmentMods/OreSpawn', status: 'approved' }); + if (url.includes('/project/cXWN0TpD/version/')) return new Response('', { status: 404 }); + if (url.startsWith('https://downloads.example/')) return new Response(payloads[url.split('/').at(-1)]); + if (url.includes('/releases?per_page=')) return Response.json([release, { tag_name: '4.1.2.121012' }]); + if (url === 'https://api.cfwidget.com/245586') { + assert.equal(useArtifact, false, 'Automatic publishing must not wait for a public CurseForge listing'); + return Response.json({ files: [ + { id: 123, name: metadata.files[0], type: process.env.RELEASE_TYPE, filesize: payloads[metadata.files[0]].length, versions: ['1.21.1', 'NeoForge'] }, + { name: 'OreSpawn-4.1.2.121012.jar', type: 'alpha' }, + ] }); + } + throw new Error(`Unexpected request: ${url}`); + }); + return { directory, payloads, requested }; +} + +test('automatic publishing reuses the exact bundle without downloading jars or waiting for CurseForge', async t => { + const fixture = await releaseFixture(t); + await prepare(fixture.directory); + const receipt = JSON.parse(await readFile(join(fixture.directory, 'modrinth-receipt.json'), 'utf8')); + assert.equal(receipt.preparedArtifact, 'original-release-bundle'); + assert.deepEqual(receipt.curseforge, { uploadCompletedByReleaseWorkflow: true, publicListingChecked: false }); + assert.equal(receipt.metadata.releaseType, 'release'); + assert.equal(fixture.requested.some(url => url.startsWith('https://downloads.example/')), false); + for (const [name, bytes] of Object.entries(fixture.payloads)) assert.deepEqual(await readFile(join(fixture.directory, name)), bytes); + assert.equal(await readFile(join(fixture.directory, 'CHANGELOG.md'), 'utf8'), 'Original public notes.'); +}); + +test('a same-size corrupt artifact cannot pass even with an edited checksum manifest', async t => { + const fixture = await releaseFixture(t); + const name = metadata.files[0]; + const changed = Buffer.from(fixture.payloads[name]); + changed[0] ^= 1; + await writeFile(join(fixture.directory, name), changed); + const manifest = fixture.payloads.SHA256SUMS.toString().replace(createHash('sha256').update(fixture.payloads[name]).digest('hex'), createHash('sha256').update(changed).digest('hex')); + await writeFile(join(fixture.directory, 'SHA256SUMS'), manifest); + await assert.rejects(prepare(fixture.directory), /sha256/); +}); + +test('missing bundle files stop publication rather than falling back to another jar', async t => { + const fixture = await releaseFixture(t); + await rm(join(fixture.directory, metadata.files[1])); + await assert.rejects(prepare(fixture.directory), /ENOENT/); + assert.equal(fixture.requested.some(url => url.startsWith('https://downloads.example/')), false); +}); + +test('manual recovery downloads original files and checks the chosen public channel', async t => { + const fixture = await releaseFixture(t, false); + process.env.RELEASE_TYPE = 'beta'; + await prepare(fixture.directory); + const receipt = JSON.parse(await readFile(join(fixture.directory, 'modrinth-receipt.json'), 'utf8')); + assert.equal(receipt.metadata.releaseType, 'beta'); + assert.equal(receipt.curseforge.id, 123); + assert.equal(fixture.requested.filter(url => url.startsWith('https://downloads.example/')).length, 4); +}); + +test('a batch cannot reuse one artifact or label alpha releases as stable', async t => { + await releaseFixture(t, true); + process.env.RELEASE_VERSION = 'latest-published'; + await assert.rejects(selectVersions(), /one explicit version/); + process.env.RELEASE_ARTIFACT = ''; + process.env.RELEASE_TYPE = 'alpha'; + await assert.rejects(selectVersions(), /stable releases only/); +}); + +test('latest-published excludes newer alpha files even when GitHub calls them ordinary releases', async t => { + await releaseFixture(t, false); + process.env.RELEASE_VERSION = 'latest-published'; + assert.deepEqual(await selectVersions(), [metadata.version]); +}); + +test('invalid channels stop before publication', async t => { + const fixture = await releaseFixture(t); + process.env.RELEASE_TYPE = 'preview'; + await assert.rejects(prepare(fixture.directory), /Invalid release channel/); + assert.deepEqual(fixture.requested, []); +}); + +test('the release workflow calls Modrinth only after GitHub and passes the original bundle and secret', async () => { + const workflow = await readFile(new URL('../workflows/deploy-release.yml', import.meta.url), 'utf8'); + const job = workflow.slice(workflow.indexOf('\n publish_modrinth:')); + assert.match(job, /needs:\n - preflight\n - build\n - publish_github/); + assert.match(job, /uses: \.\/\.github\/workflows\/publish-modrinth.yml/); + assert.match(job, /artifact_name: \$\{\{ needs.build.outputs.artifact_name \}\}/); + assert.match(job, /release_type: \$\{\{ inputs.curseforge_release_level \}\}/); + assert.match(job, /confirm_live_publication: \$\{\{ inputs.confirm_live_publication \}\}/); + assert.match(job, /MODRINTH_TOKEN: \$\{\{ secrets.MODRINTH_TOKEN \}\}/); + const confirmation = workflow.slice(workflow.indexOf('\n release_confirmation:'), workflow.indexOf('\n create_release_tag:')); + assert.match(confirmation, /for name in CURSEFORGE_TOKEN MODRINTH_TOKEN /); +}); diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index 1af3ef04..bac9ff38 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -1,6 +1,6 @@ name: Release OreSpawn -run-name: Release OreSpawn ${{ inputs.release_version }} (CurseForge ${{ inputs.curseforge_release_level }}) +run-name: Release OreSpawn ${{ inputs.release_version }} (${{ inputs.curseforge_release_level }}) on: workflow_dispatch: @@ -10,7 +10,7 @@ on: required: true type: string curseforge_release_level: - description: CurseForge release level only; this does not change the GitHub Release type. + description: Release level for CurseForge and Modrinth; GitHub uses an ordinary release. required: true default: release type: choice @@ -19,7 +19,7 @@ on: - beta - alpha confirm_live_publication: - description: Confirm publication to Maven, CurseForge, and GitHub after the build passes. + description: Confirm publication to Maven, CurseForge, GitHub and Modrinth after the build passes. required: true default: false type: boolean @@ -398,7 +398,7 @@ jobs: echo "- Version: \`$RELEASE_VERSION\`" echo "- Target branch: \`$RELEASE_BRANCH\`" echo "- Commit: \`$RELEASE_SHA\`" - echo "- CurseForge release level: \`$RELEASE_LEVEL\`" + echo "- CurseForge and Modrinth release level: \`$RELEASE_LEVEL\`" echo "- GitHub Release type: ordinary release" echo echo "### Public artifact checksums" @@ -419,6 +419,7 @@ jobs: env: CONFIRM_LIVE_PUBLICATION: ${{ inputs.confirm_live_publication }} CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} MAVEN_UPLOAD_URL: ${{ secrets.MAVEN_UPLOAD_URL }} MAVEN_UPLOAD_USERNAME: ${{ secrets.MAVEN_UPLOAD_USERNAME }} MAVEN_UPLOAD_PASSWORD: ${{ secrets.MAVEN_UPLOAD_PASSWORD }} @@ -430,7 +431,7 @@ jobs: fi echo "Live publication confirmed for ${{ needs.preflight.outputs.release_tag }}" missing=() - for name in CURSEFORGE_TOKEN MAVEN_UPLOAD_URL MAVEN_UPLOAD_USERNAME MAVEN_UPLOAD_PASSWORD; do + for name in CURSEFORGE_TOKEN MODRINTH_TOKEN MAVEN_UPLOAD_URL MAVEN_UPLOAD_USERNAME MAVEN_UPLOAD_PASSWORD; do if [[ -z "${!name:-}" ]]; then missing+=("$name") fi @@ -439,7 +440,7 @@ jobs: printf 'Required release secret is unavailable: %s\n' "${missing[@]}" >&2 exit 1 fi - echo "All four required release secrets are available." + echo "All five required release secrets are available." create_release_tag: name: Create validated release tag @@ -656,7 +657,7 @@ jobs: - name: Verify artifact run: (cd "$RUNNER_TEMP/release-input" && sha256sum --check SHA256SUMS) - - name: Publish GitHub Release last + - name: Publish GitHub Release uses: Kira-NT/mc-publish@52307b03863581dec6b652b83e597aec02ebb075 # v3.3.1 with: github-token: ${{ github.token }} @@ -674,3 +675,18 @@ jobs: ${{ runner.temp }}/release-input/${{ needs.preflight.outputs.sources_jar }} ${{ runner.temp }}/release-input/${{ needs.preflight.outputs.javadoc_jar }} ${{ runner.temp }}/release-input/SHA256SUMS + + publish_modrinth: + name: Publish Modrinth + needs: + - preflight + - build + - publish_github + uses: ./.github/workflows/publish-modrinth.yml + with: + release_version: ${{ needs.preflight.outputs.release_version }} + artifact_name: ${{ needs.build.outputs.artifact_name }} + release_type: ${{ inputs.curseforge_release_level }} + confirm_live_publication: ${{ inputs.confirm_live_publication }} + secrets: + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} diff --git a/.github/workflows/modrinth-checks.yml b/.github/workflows/modrinth-checks.yml index 36ebeb31..d10b9548 100644 --- a/.github/workflows/modrinth-checks.yml +++ b/.github/workflows/modrinth-checks.yml @@ -5,10 +5,12 @@ on: paths: - '.github/scripts/modrinth-*' - '.github/workflows/*modrinth*' + - '.github/workflows/deploy-release.yml' pull_request: paths: - '.github/scripts/modrinth-*' - '.github/workflows/*modrinth*' + - '.github/workflows/deploy-release.yml' permissions: contents: read diff --git a/.github/workflows/publish-modrinth.yml b/.github/workflows/publish-modrinth.yml index 406c071a..b639c988 100644 --- a/.github/workflows/publish-modrinth.yml +++ b/.github/workflows/publish-modrinth.yml @@ -9,13 +9,40 @@ on: description: Published version, or latest-published for the latest release of each Minecraft version and loader. required: true type: string + release_type: + description: Match the published release channel. Use release for latest-published. + required: true + default: release + type: choice + options: + - release + - beta + - alpha confirm_live_publication: description: Confirm copying the published files to Modrinth. Nothing is rebuilt or republished elsewhere. required: true default: false type: boolean + workflow_call: + inputs: + release_version: + required: true + type: string + artifact_name: + required: true + type: string + release_type: + default: release + type: string + confirm_live_publication: + required: true + type: boolean + secrets: + MODRINTH_TOKEN: + required: true permissions: + actions: read contents: read jobs: @@ -32,6 +59,8 @@ jobs: env: GH_TOKEN: ${{ github.token }} RELEASE_VERSION: ${{ inputs.release_version }} + RELEASE_TYPE: ${{ inputs.release_type || 'release' }} + RELEASE_ARTIFACT: ${{ inputs.artifact_name }} run: node .github/scripts/modrinth-release.mjs select publish: @@ -50,8 +79,16 @@ jobs: env: GH_TOKEN: ${{ github.token }} RELEASE_VERSION: ${{ matrix.version }} + RELEASE_TYPE: ${{ inputs.release_type || 'release' }} + RELEASE_ARTIFACT: ${{ inputs.artifact_name }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - name: Download the original release bundle + if: inputs.artifact_name != '' + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + with: + name: ${{ inputs.artifact_name }} + path: ${{ runner.temp }}/release-input - name: Verify published files and check for an existing upload id: prepare run: node .github/scripts/modrinth-release.mjs prepare @@ -67,7 +104,7 @@ jobs: modrinth-retry-attempts: 1 name: ${{ steps.prepare.outputs.name }} version: ${{ matrix.version }} - version-type: release + version-type: ${{ inputs.release_type || 'release' }} changelog-file: ${{ runner.temp }}/release-input/CHANGELOG.md loaders: ${{ steps.prepare.outputs.loader }} game-versions: ${{ steps.prepare.outputs.minecraft }}