forked from awslabs/service-workbench-on-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: dynamic version number from CHANGELOG and automation of Beta ve…
…rsioning (awslabs#716)
- Loading branch information
1 parent
5cad3ba
commit 63a136d
Showing
4 changed files
with
99 additions
and
6 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 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 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,36 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Get the first header (not Changelog) in CHANGELOG.md | ||
versionLine="$(cat CHANGELOG.md | grep -m 1 "[0-9]\+\.[0-9]\+\.[0-9]\+\|Beta")" | ||
|
||
# Check if it contains the word Beta | ||
if (echo "$versionLine" | grep -q "Beta") | ||
then | ||
# Do nothing | ||
echo "Nothing to change in changelog--still Beta" | ||
else | ||
git config --local user.email "action@github.com" | ||
git config --local user.name "GitHub Action" | ||
git checkout develop | ||
# Add Beta header to changelog | ||
echo "Need to add to changelog" | ||
# Get latest release number | ||
latestReleaseVersion="$(cat CHANGELOG.md | grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+" | head -n 1)" | ||
# Create ed file | ||
echo "5i | ||
## Beta | ||
[This release is in beta. Click here to see changes since ${latestReleaseVersion}.](https://github.com/maghirardelli/service-workbench-on-aws-github-actions/compare/v${latestReleaseVersion}...mainline) | ||
. | ||
w | ||
q" > add-beta.ed | ||
# Change CHANGELOG.md with ed file | ||
ed CHANGELOG.md < add-beta.ed | ||
# delete ed file | ||
rm add-beta.ed | ||
# Commit and push new changelog | ||
git add CHANGELOG.md | ||
git commit -m "docs: Add Beta" | ||
git push origin develop | ||
fi |
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