Skip to content

Commit

Permalink
github: create only one draft release (#452)
Browse files Browse the repository at this point in the history
In the latest release, commit ecc2245 caused a new draft release to
be created for each asset - I had to combine these releases manually.
What we want is to create only one draft release, and for each build job
to upload assets to the same release.

We previously relied on the fact that calling

    gh release create

multiple times creates only one release, but it turns out that calling

    gh release create --draft

multiple times creates multiple draft releases.

With this commit, we run the latter command only if there is no release
yet for the tag.
  • Loading branch information
ee7 authored Oct 23, 2021
1 parent d204965 commit a103ac4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/bin/publish-release
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env sh

version="$(echo "${REF}" | cut -d'/' -f3)"
latest_release_tag="$(gh release view --json tagName --jq '.tagName')"
build_tag="$(echo "${REF}" | cut -d'/' -f3)"

gh release create --draft "${version}"
gh release upload "${version}" "${ARTIFACT_FILE}"
if [ "${latest_release_tag}" != "${build_tag}" ]; then
gh release create --draft "${build_tag}"
fi
gh release upload "${build_tag}" "${ARTIFACT_FILE}"

0 comments on commit a103ac4

Please sign in to comment.