File tree 1 file changed +23
-9
lines changed
1 file changed +23
-9
lines changed Original file line number Diff line number Diff line change 21
21
uses : actions/checkout@v2
22
22
with :
23
23
ref : ${{ github.ref }}
24
+ fetch-depth : 0
24
25
25
26
- name : Install dependencies
26
27
run : |
@@ -46,16 +47,29 @@ jobs:
46
47
47
48
- name : Commit changes
48
49
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')
52
57
cd destination-repo
53
- git config user.email "[email protected] "
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"
55
62
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
+ echo "git tag to be pushed: '$TAG_NAME'"
64
+ if [ -z "$(git status --porcelain)" ]; then
65
+ echo "No changes to commit. push only new tag."
66
+ git tag $TAG_NAME
67
+ git push --tags
68
+ else
69
+ git commit -m "$TAG_NAME | $LAST_COMMIT_MESSAGE"
70
+ git tag "$TAG_NAME"
71
+ git push --tags
72
+ git push origin master
73
+ fi
60
74
env :
61
75
TAG_NAME : ${{ github.event.client_payload.tag_name }}
You can’t perform that action at this time.
0 commit comments