File tree Expand file tree Collapse file tree 1 file changed +22
-9
lines changed Expand file tree Collapse file tree 1 file changed +22
-9
lines changed Original file line number Diff line number Diff line change 2121 uses : actions/checkout@v2
2222 with :
2323 ref : ${{ github.ref }}
24+ fetch-depth : 0
2425
2526 - name : Install dependencies
2627 run : |
@@ -46,16 +47,28 @@ jobs:
4647
4748 - name : Commit changes
4849 run : |
49- bash -c "if [[ ${{ github.ref }} == 'refs/tags/'* ]]; then export TAG_NAME=${{ github.ref }}; fi"
50- echo "Tag name: $TAG_NAME"
51- echo "payload: ${{ github.event.client_payload.tag_name }}"
50+ if [[ "${{ github.ref }}" == refs/tags/* ]]; then
51+ TAG_NAME="${GITHUB_REF#refs/tags/}"
52+ echo "Tag name: $TAG_NAME"
53+ echo "payload: ${{ github.event.client_payload.tag_name }}"
54+ echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
55+ fi
56+ LAST_COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s')
5257 cd destination-repo
53- git config user.email "m.mahdi.m79@gmail.com"
54- git config user.name "Mohammad Mahdi Malmasi"
58+ LAST_GIT_COMMIT_NAME=$(git log -1 --pretty=format:'%an')
59+ LAST_GIT_COMMIT_EMAIL=$(git log -1 --pretty=format:'%ae')
60+ git config user.name "$LAST_GIT_COMMIT_NAME"
61+ git config user.email "$LAST_GIT_COMMIT_EMAIL"
5562 git add .
56- git commit -m "Update for tag: $TAG_NAME"
57- git tag $TAG_NAME
58- git push --tags
59- git push origin master
63+ if [ -z "$(git status --porcelain)" ]; then
64+ echo "No changes to commit. push only new tag."
65+ git tag $TAG_NAME
66+ git push --follow-tags
67+ else
68+ git commit -m "$TAG_NAME | $LAST_COMMIT_MESSAGE"
69+ git tag "$TAG_NAME"
70+ git push --follow-tags
71+ git push origin master
72+ fi
6073 env :
6174 TAG_NAME : ${{ github.event.client_payload.tag_name }}
You can’t perform that action at this time.
0 commit comments