@@ -3,25 +3,11 @@ name: Run tests, Tag release
3
3
on :
4
4
push :
5
5
branches :
6
- # explicit deny all here to make sure there isnt a commit loop
7
- - ' !*'
8
6
- main
9
7
- fix/*
10
8
11
9
jobs :
12
- create_tag :
13
- runs-on : ubuntu-latest
14
- if : github.ref == 'refs/heads/main'
15
- needs : run_tests
16
- steps :
17
- - name : Checkout
18
- uses : actions/checkout@v2
19
-
20
- - name : check if tag already exists
21
- run : git fetch --depth=1 origin +refs/tags/*:refs/tags/* && git rev-parse "$(cat VERSION)" >/dev/null 2>&1 && exit 1 || exit 0
22
10
23
- - name : create tag
24
- run : git config --global user.email "${{ github.actor }}" && git config --global user.name "${{ github.actor }}" && git tag -a -m "$(cat VERSION)" $(cat VERSION) && git push --follow-tags
25
11
run_tests :
26
12
runs-on : ubuntu-latest
27
13
steps :
98
84
destination_branch : commit_message_test
99
85
deploy_key : ${{ secrets.DEPLOY_KEY }}
100
86
commit_message : testing a custom commit message (${{ github.sha }})
87
+
88
+
89
+ # Test that fails on nothing to commit - a copy of the previous test
90
+ - name : test issue where workflow fails when there is nothing to commit
91
+ uses : ./
92
+ with :
93
+ source : tmp.txt
94
+ destination_repo : leigholiver/commit-with-deploy-key
95
+ destination_branch : commit_message_test
96
+ deploy_key : ${{ secrets.DEPLOY_KEY }}
97
+ commit_message : testing a custom commit message (${{ github.sha }})
98
+
99
+ # Test that nothing to commit is OK
100
+
101
+
102
+
103
+ # If the tests are successful, and we've merged to main, create a tag
104
+ create_tag :
105
+ runs-on : ubuntu-latest
106
+ if : github.ref == 'refs/heads/main'
107
+ needs : run_tests
108
+ steps :
109
+ - name : Checkout
110
+ uses : actions/checkout@v2
111
+
112
+ - name : check if tag already exists
113
+ run : git fetch --depth=1 origin +refs/tags/*:refs/tags/* && git rev-parse "$(cat VERSION)" >/dev/null 2>&1 && exit 1 || exit 0
114
+
115
+ - name : create tag
116
+ run : git config --global user.email "${{ github.actor }}" && git config --global user.name "${{ github.actor }}" && git tag -a -m "$(cat VERSION)" $(cat VERSION) && git push --follow-tags
0 commit comments