Skip to content

Commit 535a28e

Browse files
committed
Clarify release script usage
1 parent f7f7a94 commit 535a28e

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,14 @@ steps:
209209
run: echo "${{ steps.test-action.outputs.time }}"
210210
```
211211
212-
## Publishing a new release
212+
## Publishing a New Release
213213
214-
This project includes a helper script designed to streamline the process of
215-
tagging and pushing new releases for GitHub Actions.
214+
This project includes a helper script, [`script/release`](./script/release)
215+
designed to streamline the process of tagging and pushing new releases for
216+
GitHub Actions.
216217

217218
GitHub Actions allows users to select a specific version of the action to use,
218-
based on release tags. Our script simplifies this process by performing the
219+
based on release tags. This script simplifies this process by performing the
219220
following steps:
220221

221222
1. **Retrieving the latest release tag:** The script starts by fetching the most

script/release

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,59 @@
11
#!/bin/bash
22

33
# About:
4-
# This is a helper script to tag and push a new release.
5-
# GitHub Actions use release tags to allow users to select a specific version of the action to use.
4+
#
5+
# This is a helper script to tag and push a new release. GitHub Actions use
6+
# release tags to allow users to select a specific version of the action to use.
7+
#
8+
# See: https://github.com/actions/typescript-action#publishing-a-new-release
9+
#
610
# This script will do the following:
11+
#
712
# 1. Get the latest release tag
8-
# 2. Prompt the user for a new release tag (while displaying the latest release tag, and a regex to validate the new tag)
13+
# 2. Prompt the user for a new release tag
914
# 3. Tag the new release
1015
# 4. Push the new tag to the remote
11-
16+
#
1217
# Usage:
18+
#
1319
# script/release
1420

15-
# COLORS
21+
# Terminal colors
1622
OFF='\033[0m'
1723
RED='\033[0;31m'
1824
GREEN='\033[0;32m'
1925
BLUE='\033[0;34m'
2026

27+
# Get the latest release tag
2128
latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)")
2229

23-
# if the latest_tag is empty, then there are no tags - let the user know
2430
if [[ -z "$latest_tag" ]]; then
25-
echo -e "No tags found (yet) - continue to create your first tag and push it"
31+
# There are no existing release tags
32+
echo -e "No tags found (yet) - Continue to create and push your first tag"
2633
latest_tag="[unknown]"
2734
fi
2835

36+
# Display the latest release tag
2937
echo -e "The latest release tag is: ${BLUE}${latest_tag}${OFF}"
30-
read -r -p 'New Release Tag (vX.X.X format): ' new_tag
3138

39+
# Prompt the user for the new release tag
40+
read -r -p 'Enter a new release tag (vX.X.X format): ' new_tag
41+
42+
# Validate the new release tag
3243
tag_regex='v[0-9]+\.[0-9]+\.[0-9]+$'
3344
if echo "$new_tag" | grep -q -E "$tag_regex"; then
3445
echo -e "Tag: ${BLUE}$new_tag${OFF} is valid"
3546
else
47+
# Release tag is not `vX.X.X` format
3648
echo -e "Tag: ${BLUE}$new_tag${OFF} is ${RED}not valid${OFF} (must be in vX.X.X format)"
3749
exit 1
3850
fi
3951

52+
# Tag the new release
4053
git tag -a "$new_tag" -m "$new_tag Release"
54+
echo -e "${GREEN}Tagged: $new_tag${OFF}"
4155

42-
echo -e "${GREEN}OK${OFF} - Tagged: $new_tag"
43-
56+
# Push the new tag to the remote
4457
git push --tags
45-
46-
echo -e "${GREEN}OK${OFF} - Tags pushed to remote!"
47-
echo -e "${GREEN}DONE${OFF}"
58+
echo -e "${GREEN}Release tag pushed to remote${OFF}"
59+
echo -e "${GREEN}Done!${OFF}"

0 commit comments

Comments
 (0)