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 }}
with:
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({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `app-v${process.env.PACKAGE_VERSION}`,
tag_name: tag,
name: `Psysonic v${process.env.PACKAGE_VERSION}`,
body: 'See the assets to download this version and install.',
draft: false,
prerelease: false
})
return data.id
});
return data.id;
build-macos-windows:
needs: create-release