Skip to content

Commit 5b86301

Browse files
committed
create or update the release
Signed-off-by: kerthcet <kerthcet@gmail.com>
1 parent f6a2bbe commit 5b86301

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

.github/workflows/release.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,23 @@ jobs:
9191
sha256sum sandd-* > sandd-checksums.txt
9292
cat sandd-checksums.txt
9393
94-
- name: Create release
94+
- name: Create or update release
9595
env:
9696
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9797
run: |
98-
gh release create "$GITHUB_REF_NAME" \
99-
--repo "$GITHUB_REPOSITORY" \
100-
--title "$GITHUB_REF_NAME" \
101-
--generate-notes \
102-
artifacts/*
98+
# A release for this tag may already exist (e.g. cut by hand, or a
99+
# re-run of this workflow). `gh release create` hard-fails in that
100+
# case, so upload the assets to the existing release instead.
101+
if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
102+
echo "Release $GITHUB_REF_NAME already exists; uploading assets."
103+
gh release upload "$GITHUB_REF_NAME" \
104+
--repo "$GITHUB_REPOSITORY" \
105+
--clobber \
106+
artifacts/*
107+
else
108+
gh release create "$GITHUB_REF_NAME" \
109+
--repo "$GITHUB_REPOSITORY" \
110+
--title "$GITHUB_REF_NAME" \
111+
--generate-notes \
112+
artifacts/*
113+
fi

0 commit comments

Comments
 (0)