8
8
branches : [ master ]
9
9
10
10
jobs :
11
- tag-commit -if-version-updated :
12
- name : Tag commit if new version number in package.json
11
+ check -if-version-updated :
12
+ name : Check if version updated
13
13
runs-on : ubuntu-latest
14
14
outputs :
15
- NEW_VERSION : ${{ steps.check-if-version-updated .outputs.NEW_VERSION }}
15
+ NEW_VERSION : ${{ steps.step2 .outputs.NEW_VERSION }}
16
16
17
17
steps :
18
18
- name : Check out Git repository
19
19
uses : actions/checkout@v2
20
20
21
21
- name : Check if version updated
22
- id : check-if-version-updated
22
+ id : step2
23
23
run : |
24
24
VERSION=$(cat 'package.json' | jq -r '.version')
25
- VERSION=0.1.6
25
+ # VERSION=0.1.6
26
26
if [[ ! $(git tag | grep "${VERSION}") ]]; then
27
27
echo "New version: v${VERSION}"
28
28
echo "::set-output name=NEW_VERSION::v${VERSION}"
@@ -31,18 +31,28 @@ jobs:
31
31
echo "::set-output name=NEW_VERSION::"
32
32
fi
33
33
34
+ tag-commit :
35
+ name : Tag commit
36
+ needs : check-if-version-updated
37
+ if : ${{needs.check-if-version-updated.outputs.NEW_VERSION}}
38
+ runs-on : ubuntu-latest
39
+ env :
40
+ GIT_NAME : " Github Action: ${{github.action}}"
41
+ GIT_EMAIL : no-reply@karsten-moholt.no
42
+ TAG : ${{steps.check-if-version-updated.outputs.NEW_VERSION}}
43
+ steps :
44
+ - name : Check out Git repository
45
+ uses : actions/checkout@v2
46
+
34
47
- name : Tag commit with version
35
- if : ${{steps.check-if-version-updated.outputs.NEW_VERSION}}
36
- env :
37
- TAG : ${{steps.check-if-version-updated.outputs.NEW_VERSION}}
38
48
run : |
39
- git config --global user.email "no-reply@karsten-moholt.no "
40
- git config --global user.name "Github Action: ${{github.action} }"
49
+ git config --global user.name "${GIT_NAME} "
50
+ git config --global user.email "${GIT_EMAIL }"
41
51
git tag -a ${TAG} -m ${TAG}
42
52
git push --follow-tags
43
53
44
54
release :
45
- needs : tag-commit-if-version-updated
55
+ needs : tag-commit
46
56
if : ${{needs.tag-commit-if-version-updated.outputs.NEW_VERSION}}
47
57
runs-on : ${{ matrix.os }}
48
58
0 commit comments