Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,37 +56,13 @@ jobs:
with:
bump: calver
version-source: tag
token: ${{ steps.setup-git-user.outputs.token }}
targets: |
- file: CITATION.cff
pattern: '^version: {version}$'
- file: CITATION.cff
pattern: '^date-released: "{date}"$'

# The release step refuses an existing tag or release too, but only after
# the push, which would leave the bump on the default branch.
- name: Refuse an existing tag or release
env:
GH_TOKEN: ${{ steps.setup-git-user.outputs.token }}
VERSION: ${{ steps.bump.outputs.version }}
shell: bash
run: |
set -euo pipefail
STATUS=0
git ls-remote --exit-code --tags origin "refs/tags/${VERSION}" > /dev/null || STATUS=$?
case "${STATUS}" in
0) echo "::error::Tag ${VERSION} already exists. Delete it, or create its release by hand, then dispatch this workflow again."; exit 1 ;;
2) ;;
*) echo "::error::Could not list the tags of origin (git exit ${STATUS})."; exit 1 ;;
esac
if OUTPUT=$(gh release view "${VERSION}" 2>&1); then
echo "::error::A release ${VERSION} already exists, perhaps as a draft. Delete it, then dispatch this workflow again."
exit 1
fi
if ! grep -qi 'release not found' <<< "${OUTPUT}"; then
echo "::error::Could not check for release ${VERSION}: ${OUTPUT}"
exit 1
fi

# The App is exempt from the pull request rule of the default branch, and
# [skip ci] keeps CI from running again on a tree it has checked.
- name: Push the version
Expand Down
Loading