-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathtag-rc.sh
More file actions
34 lines (28 loc) · 758 Bytes
/
tag-rc.sh
File metadata and controls
34 lines (28 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
#
# Add an empty commit and delete the remote tag if the tag exists.
# Tag and push the branch.
#
# Local wet run:
#
# DRY_RUN=false bash local-env.sh tag-rc <tag>
#
set -euo pipefail
TAG="$1"
check_not_empty \
TAG \
\
DRY_RUN
if [ "$(git tag --list "$TAG")" = "$TAG" ]; then
gh_log warning "Tag $TAG exists."
if [ "$DRY_RUN" = "false" ]; then
git push --delete origin "$TAG"
fi
gh_log warning "Existing tag '$TAG' has been deleted."
fi
git commit --allow-empty --message "Empty commit to trigger CI"
git tag --force --annotate "$TAG" --message "Upstream release automation"
if [ "$DRY_RUN" = "false" ]; then
git push --follow-tags
fi
gh_summary "Release branch has been tagged with $TAG."