File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ Add the following step at the end of your job.
3838 commit_user_name : My GitHub Actions Bot
3939 commit_user_email : my-github-actions-bot@example.org
4040 commit_author : Author <actions@gitub.com>
41+
42+ # Optional tag message. Will create and push a new tag to the remote repository
43+ tagging_message : ' v1.0.0'
4144` ` `
4245
4346The Action will only commit files back, if changes are available. The resulting commit **will not trigger** another GitHub Actions Workflow run!
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ inputs:
3434 description : Value used for the commit author. Defaults to the username of whoever triggered this workflow run.
3535 required : false
3636 default : ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
37+ tagging_message :
38+ description : Message used to create a new git tag with the commit. Keep this empty, if no tag should be created.
39+ required : false
40+ default : ' '
3741
3842outputs :
3943 changes_detected :
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ _main() {
1717
1818 _local_commit
1919
20+ _tag_commit
21+
2022 _push_to_github
2123 else
2224
@@ -59,12 +61,21 @@ _local_commit() {
5961 git commit -m " $INPUT_COMMIT_MESSAGE " --author=" $INPUT_COMMIT_AUTHOR " ${INPUT_COMMIT_OPTIONS: +" $INPUT_COMMIT_OPTIONS " }
6062}
6163
64+ _tag_commit () {
65+ echo " INPUT_TAGGING_MESSAGE: ${INPUT_TAGGING_MESSAGE} "
66+
67+ if [ -n " $INPUT_TAGGING_MESSAGE " ]
68+ then
69+ git tag -a " $INPUT_TAGGING_MESSAGE " -m " $INPUT_TAGGING_MESSAGE "
70+ fi
71+ }
72+
6273_push_to_github () {
6374 if [ -z " $INPUT_BRANCH " ]
6475 then
65- git push origin
76+ git push origin --tags
6677 else
67- git push --set-upstream origin " HEAD:$INPUT_BRANCH "
78+ git push --set-upstream origin " HEAD:$INPUT_BRANCH " --tags
6879 fi
6980}
7081
You can’t perform that action at this time.
0 commit comments