fix workflow
Some checks failed
Release / build-release (push) Failing after 8s

This commit is contained in:
Ludwig Lehnert
2026-06-29 13:23:01 +00:00
parent 073ed667cd
commit 20e9374154

View File

@@ -38,14 +38,53 @@ jobs:
(cd package && zip -r "../${archive}" LICENSE setup.ps1 PolicyDefinitions)
- name: Create or update release
uses: actions/github-script@v7
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "${SHORT_SHA}" >/dev/null 2>&1; then
gh release upload "${SHORT_SHA}" "${ARCHIVE}" --clobber
else
gh release create "${SHORT_SHA}" "${ARCHIVE}" \
--target "${GITHUB_SHA}" \
--title "${SHORT_SHA}" \
--notes "Automated build for ${GITHUB_SHA}."
fi
SHORT_SHA: ${{ env.SHORT_SHA }}
ARCHIVE: ${{ env.ARCHIVE }}
with:
script: |
const fs = require('fs');
const path = require('path');
const owner = context.repo.owner;
const repo = context.repo.repo;
const tag = process.env.SHORT_SHA;
const archive = process.env.ARCHIVE;
let release;
try {
const existing = await github.rest.repos.getReleaseByTag({ owner, repo, tag });
release = existing.data;
} catch (error) {
if (error.status !== 404) throw error;
const created = await github.rest.repos.createRelease({
owner,
repo,
tag_name: tag,
target_commitish: context.sha,
name: tag,
body: `Automated build for ${context.sha}.`,
});
release = created.data;
}
const assetName = path.basename(archive);
for (const asset of release.assets || []) {
if (asset.name === assetName) {
await github.rest.repos.deleteReleaseAsset({ owner, repo, asset_id: asset.id });
}
}
const data = fs.readFileSync(archive);
await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: release.id,
name: assetName,
data,
headers: {
'content-type': 'application/zip',
'content-length': data.length,
},
});