-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-> Added support to pull_request event -> Updated ReadMe file
- Loading branch information
1 parent
ae2e823
commit 73140c6
Showing
2 changed files
with
26 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,30 @@ | ||
#!/bin/sh -l | ||
set -e | ||
|
||
file_name=$1 | ||
tag_version=$2 | ||
echo "\nInput file name: $file_name : $tag_version" | ||
|
||
([ -z "$GITHUB_ONLY_ON_COMMIT" ]) || exit 0 | ||
echo "Git Head Ref: ${GITHUB_HEAD_REF}" | ||
echo "Git Base Ref: ${GITHUB_BASE_REF}" | ||
echo "Git Event Name: ${GITHUB_EVENT_NAME}" | ||
|
||
echo "\nStarting Git Operations" | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Bump-N-Tag App" | ||
|
||
github_ref="" | ||
|
||
if test "${GITHUB_EVENT_NAME}" = "push" | ||
then | ||
github_ref=${GITHUB_REF} | ||
else | ||
github_ref=${GITHUB_HEAD_REF} | ||
git checkout $github_ref | ||
fi | ||
|
||
|
||
echo "Git Checkout" | ||
|
||
if test -f $file_name; then | ||
content=$(cat $file_name) | ||
|
@@ -45,16 +65,14 @@ echo "\nUpdated version: $newver" | |
newcontent=$(echo ${content/$oldver/$newver}) | ||
echo $newcontent > $file_name | ||
|
||
echo "\nStarting Git Operations" | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Bump-N-Tag App" | ||
|
||
git add -A | ||
git commit -m "Incremented to ${newver}" -m "[skip ci]" | ||
([ -n "$tag_version" ] && [ "$tag_version" = "true" ]) && (git tag -a "${newver}" -m "[skip ci]") || echo "No tag created" | ||
|
||
git show-ref | ||
git push --follow-tags "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:${GITHUB_REF} | ||
echo "Git Push" | ||
|
||
git push --follow-tags "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:$github_ref | ||
|
||
|
||
echo "\nEnd of Action\n\n" | ||
|