11name : update clients
22
33on :
4- workflow_dispatch :
5- inputs :
6- title :
7- description : " Title for PR's"
8- required : true
4+ push :
5+ branches : [develop]
6+ workflow_dispatch :
7+ inputs :
8+ title :
9+ description : " Title For PR's"
10+ required : true
11+ branch :
12+ description : " OpenAPI branch"
13+ required : true
14+ default : " develop"
915
1016jobs :
17+ title :
18+ runs-on : ubuntu-latest
19+ outputs :
20+ title : ${{ steps.get-title.outputs.fmt_title }}
21+ steps :
22+ - id : get-title
23+ run : |
24+ if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
25+ echo "fmt_title=${{ github.event.inputs.title }}" >> "$GITHUB_OUTPUT"
26+ else
27+ echo "fmt_title=${GITHUB_SHA::8}" >> "$GITHUB_OUTPUT"
28+ fi
29+
1130 update-js-client :
31+ needs : title
1232 runs-on : ubuntu-latest
1333 steps :
1434 - name : Checkout Specification Repo
15- uses : actions/checkout@v2
35+ uses : actions/checkout@v4
1636 with :
17- path : ' FaceSDK-web-openapi'
37+ path : " FaceSDK-web-openapi"
38+ ref : ${{ github.event.inputs.branch }}
39+
1840 - name : Checkout JS Client Repo
19- uses : actions/checkout@v2
41+ uses : actions/checkout@v4
2042 with :
21- repository : ' regulaforensics/FaceSDK-web-js-client'
43+ repository : " regulaforensics/FaceSDK-web-js-client"
2244 token : ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
23- path : ' js-client'
45+ path : " js-client"
46+ ref : " develop"
47+
2448 - name : Update Model According To Specification
2549 working-directory : js-client
2650 run : |
2751 npm install
2852 ./update-models.sh
53+
2954 - name : Push Changes Back To Client Repo
3055 working-directory : js-client
3156 run : |
3257 git checkout -b ${GITHUB_SHA::8}
3358 git config --local user.email "action@github.com"
3459 git config --local user.name "GitHub Action"
60+
61+ if git diff-index --quiet HEAD --; then
62+ echo "No changes to commit."
63+ exit 0
64+ fi
65+
3566 git add --all
36- git commit -m "${{ github.event.inputs.title }}" -a
37- git push --set-upstream origin ${GITHUB_SHA::8}
38- gh pr create --fill --draft
67+ git commit -m "Commit: ${{ needs.title.outputs.title }}" -a
68+
69+ if [ $? -eq 0 ]; then
70+ git push --set-upstream origin ${GITHUB_SHA::8}
71+ gh pr create --fill --base develop
72+ else
73+ echo "Nothing to commit."
74+ fi
3975 env :
4076 GITHUB_TOKEN : ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
4177
4278 update-java-client :
79+ needs : title
4380 runs-on : ubuntu-latest
4481 steps :
4582 - name : Specify Java Version
46- uses : actions/setup-java@v1
83+ uses : actions/setup-java@v4
4784 with :
85+ distribution : " zulu"
4886 java-version : 11
4987 java-package : jdk
88+
5089 - name : Checkout Specification Repo
51- uses : actions/checkout@v2
90+ uses : actions/checkout@v4
5291 with :
53- path : ' FaceSDK-web-openapi'
92+ path : " FaceSDK-web-openapi"
93+ ref : ${{ github.event.inputs.branch }}
94+
5495 - name : Checkout Java Client Repo
55- uses : actions/checkout@v2
96+ uses : actions/checkout@v4
5697 with :
57- repository : ' regulaforensics/FaceSDK-web-java-client'
98+ repository : " regulaforensics/FaceSDK-web-java-client"
5899 token : ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
59- path : ' java-client'
100+ path : " java-client"
101+ ref : " develop"
102+
60103 - name : Update Model According To Specification
61104 working-directory : java-client
62105 run : |
63106 ./update-models.sh
107+
64108 - name : Push Changes Back To Client Repo
65109 working-directory : java-client
66110 run : |
67111 git checkout -b ${GITHUB_SHA::8}
68112 git config --local user.email "action@github.com"
69113 git config --local user.name "GitHub Action"
114+
115+ if git diff-index --quiet HEAD --; then
116+ echo "No changes to commit."
117+ exit 0
118+ fi
119+
70120 git add --all
71- git commit -m "${{ github.event.inputs.title }}" -a
72- git push --set-upstream origin ${GITHUB_SHA::8}
73- gh pr create --fill --draft
121+ git commit -m "Commit: ${{ needs.title.outputs.title }}" -a
122+
123+ if [ $? -eq 0 ]; then
124+ git push --set-upstream origin ${GITHUB_SHA::8}
125+ gh pr create --fill --base develop
126+ else
127+ echo "Nothing to commit."
128+ fi
74129 env :
75130 GITHUB_TOKEN : ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
76131
77132 update-python-client :
78133 runs-on : ubuntu-latest
79134 steps :
80135 - name : Checkout Specification Repo
81- uses : actions/checkout@v2
136+ uses : actions/checkout@v4
82137 with :
83- path : ' FaceSDK-web-openapi'
138+ path : " FaceSDK-web-openapi"
139+ ref : ${{ github.event.inputs.branch }}
140+
84141 - name : Checkout Python Client Repo
85- uses : actions/checkout@v2
142+ uses : actions/checkout@v4
86143 with :
87- repository : ' regulaforensics/FaceSDK-web-python-client'
144+ repository : " regulaforensics/FaceSDK-web-python-client"
88145 token : ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
89- path : ' python-client'
146+ path : " python-client"
147+ ref : " develop"
148+
90149 - name : Update Model According To Specification
91150 working-directory : python-client
92151 run : |
93152 ./update-models.sh
153+
94154 - name : Push Changes Back To Client Repo
95155 working-directory : python-client
96156 run : |
97157 git checkout -b ${GITHUB_SHA::8}
98158 git config --local user.email "action@github.com"
99159 git config --local user.name "GitHub Action"
160+
161+ if git diff-index --quiet HEAD --; then
162+ echo "No changes to commit."
163+ exit 0
164+ fi
165+
100166 git add --all
101- git commit -m "${{ github.event.inputs.title }}" -a
102- git push --set-upstream origin ${GITHUB_SHA::8}
103- gh pr create --fill --draft
167+ git commit -m "Commit: ${{ needs.title.outputs.title }}" -a
168+
169+ if [ $? -eq 0 ]; then
170+ git push --set-upstream origin ${GITHUB_SHA::8}
171+ gh pr create --fill --base develop
172+ else
173+ echo "Nothing to commit."
174+ fi
104175 env :
105176 GITHUB_TOKEN : ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
106177
@@ -110,31 +181,47 @@ jobs:
110181 - name : Specify Dotnet Version
111182 uses : actions/setup-dotnet@v1
112183 with :
113- dotnet-version : ' 3.1.x'
184+ dotnet-version : " 3.1.x"
185+
114186 - name : Checkout Specification Repo
115- uses : actions/checkout@v2
187+ uses : actions/checkout@v4
116188 with :
117- path : ' FaceSDK-web-openapi'
118- - name : Checkout CSharp Client Repo
119- uses : actions/checkout@v2
189+ path : " FaceSDK-web-openapi"
190+ ref : ${{ github.event.inputs.branch }}
191+
192+ - name : Checkout C# Client Repo
193+ uses : actions/checkout@v4
120194 with :
121- repository : ' regulaforensics/FaceSDK-web-csharp-client'
195+ repository : " regulaforensics/FaceSDK-web-csharp-client"
122196 token : ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
123- path : ' csharp-client'
197+ path : " csharp-client"
198+ ref : " develop"
199+
124200 - name : Update Model According To Specification
125201 working-directory : csharp-client
126202 run : |
127203 ./update-models.sh
204+
128205 - name : Push Changes Back To Client Repo
129206 working-directory : csharp-client
130207 run : |
131208 git checkout -b ${GITHUB_SHA::8}
132209 git config --local user.email "action@github.com"
133210 git config --local user.name "GitHub Action"
134- git checkout src/Regula.FaceSDK.WebClient/Api/SearchApi.cs
211+
212+ if git diff-index --quiet HEAD --; then
213+ echo "No changes to commit."
214+ exit 0
215+ fi
216+
135217 git add --all
136- git commit -m "${{ github.event.inputs.title }}" -a
137- git push --set-upstream origin ${GITHUB_SHA::8}
138- gh pr create --fill --draft
218+ git commit -m "Commit: ${{ needs.title.outputs.title }}" -a
219+
220+ if [ $? -eq 0 ]; then
221+ git push --set-upstream origin ${GITHUB_SHA::8}
222+ gh pr create --fill --base develop
223+ else
224+ echo "Nothing to commit."
225+ fi
139226 env :
140227 GITHUB_TOKEN : ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
0 commit comments