Skip to content

Commit 82d9de3

Browse files
committed
fix(release): make unsigned macOS asset cleanup best-effort
1 parent 5106aeb commit 82d9de3

2 files changed

Lines changed: 24 additions & 17 deletions

File tree

.github/workflows/on-release-published.yml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,27 +127,32 @@ jobs:
127127
.out/darwin/fscript-${{ github.ref_name }}-darwin-x64.zip
128128
129129
- name: Remove unsigned macOS artifact
130+
continue-on-error: true
130131
uses: actions/github-script@v7
131132
with:
132133
script: |
133-
const tag = context.ref.replace('refs/tags/', '');
134-
const unsignedName = `fscript-${tag}-darwin-unsigned.zip`;
135-
const { data: release } = await github.rest.repos.getReleaseByTag({
136-
owner: context.repo.owner,
137-
repo: context.repo.repo,
138-
tag,
139-
});
140-
const asset = release.assets.find(a => a.name === unsignedName);
141-
if (!asset) {
142-
core.info(`Unsigned artifact not found: ${unsignedName}`);
143-
return;
134+
try {
135+
const tag = context.ref.replace('refs/tags/', '');
136+
const unsignedName = `fscript-${tag}-darwin-unsigned.zip`;
137+
const { data: release } = await github.rest.repos.getReleaseByTag({
138+
owner: context.repo.owner,
139+
repo: context.repo.repo,
140+
tag,
141+
});
142+
const asset = release.assets.find(a => a.name === unsignedName);
143+
if (!asset) {
144+
core.info(`Unsigned artifact not found: ${unsignedName}`);
145+
return;
146+
}
147+
await github.rest.repos.deleteReleaseAsset({
148+
owner: context.repo.owner,
149+
repo: context.repo.repo,
150+
asset_id: asset.id,
151+
});
152+
core.info(`Deleted unsigned artifact: ${unsignedName}`);
153+
} catch (error) {
154+
core.warning(`Best-effort cleanup failed: ${error?.message ?? error}`);
144155
}
145-
await github.rest.repos.deleteReleaseAsset({
146-
owner: context.repo.owner,
147-
repo: context.repo.repo,
148-
asset_id: asset.id,
149-
});
150-
core.info(`Deleted unsigned artifact: ${unsignedName}`);
151156
152157
update-homebrew-tap:
153158
uses: ./.github/workflows/release-homebrew-tap.yml

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ All notable changes to FScript are documented in this file.
44

55
## [Unreleased]
66

7+
- Made unsigned macOS release-asset cleanup best-effort so transient GitHub API failures no longer fail the release workflow.
8+
79
## [0.48.0]
810

911

0 commit comments

Comments
 (0)