ci: upsert release — reuse existing release if tag already exists

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Psychotoxical
2026-03-15 12:14:22 +01:00
parent a5fd70d3eb
commit 9bdd433a4b
+14 -3
View File
@@ -29,16 +29,27 @@ jobs:
PACKAGE_VERSION: ${{ steps.get-version.outputs.version }} PACKAGE_VERSION: ${{ steps.get-version.outputs.version }}
with: with:
script: | script: |
const tag = `app-v${process.env.PACKAGE_VERSION}`;
try {
const { data } = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag,
});
return data.id;
} catch (e) {
if (e.status !== 404) throw e;
}
const { data } = await github.rest.repos.createRelease({ const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
tag_name: `app-v${process.env.PACKAGE_VERSION}`, tag_name: tag,
name: `Psysonic v${process.env.PACKAGE_VERSION}`, name: `Psysonic v${process.env.PACKAGE_VERSION}`,
body: 'See the assets to download this version and install.', body: 'See the assets to download this version and install.',
draft: false, draft: false,
prerelease: false prerelease: false
}) });
return data.id return data.id;
build-macos-windows: build-macos-windows:
needs: create-release needs: create-release