generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
slack notification after release (#166)
## Description Post a slack notification after a release has been published. ## Related Issues closes #144 ## Additional Notes - Renaming next_tag.sh to version_name.sh to better match functionality. Also updating script to return the current tag name if the commit HEAD is a version tag. - Reorganizing the release.yml into 3 different jobs. 1. package: building and pushing the docker image 2. docs: building and publishing the public docs 3. release: creating the release and posting to slack
- Loading branch information
1 parent
a58652c
commit b1cdc7d
Showing
3 changed files
with
116 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
# | ||
# Get the name of the version if the commit is tagged, else | ||
# calculate the next feature version name for the project. | ||
# | ||
# Usage: scripts/version_name.sh | ||
# | ||
# The format of the tag is vYY.X.0-rc.Z, where: | ||
# - YY is the current two digit year | ||
# - X is the next feature version this year | ||
# - Z is the number of commits on main since the last tag | ||
|
||
HEAD_TAG=$(git describe --tags --exact-match HEAD 2>/dev/null) | ||
# Check if the HEAD commit is tagged like '^v[0-9]+\.[0-9]+\.[0-9]+$' | ||
if echo $HEAD_TAG | grep -q "^v[0-9]\+\.[0-9]\+\.[0-9]\+$"; then | ||
echo $HEAD_TAG | ||
else | ||
# Get the current two digit year | ||
year=$(date +"%y") | ||
# Get the latest tag | ||
latest_tag=$(git describe --tags --match "v*" --abbrev=0 $(git rev-list --tags --max-count=1) 2>/dev/null || echo "") | ||
# Count the number of commits between the latest tag and HEAD | ||
commits=$(git rev-list --count $latest_tag..HEAD --) | ||
# Get latest tag for the current year, or default to v0.0.0 | ||
latest_tag_for_year=$(git describe --tags --match "v${year}.*" --abbrev=0 $(git rev-list --tags --max-count=1) 2>/dev/null || echo "v0.0.0") | ||
# Get the next feature version | ||
next_feature_ver=$(($(echo $latest_tag_for_year | cut -d '.' -f 2) + 1)) | ||
echo "v${year}.${next_feature_ver}.0-rc.${commits}" | ||
fi |