@@ -164,335 +164,3 @@ jobs:
164164 status : ${{job.status}}
165165 fields : repo,message,commit,author,action,ref,workflow,job
166166 author_name : Github Action Slack
167- name : " [Dispatch] Release"
168-
169- on :
170- workflow_dispatch :
171- inputs :
172- version :
173- description : ' enter version(x.y.z)'
174- required : true
175- default : ' 2.0.0'
176- container_arch :
177- type : choice
178- description : ' choose container architecture'
179- default : linux/amd64,linux/arm64
180- options :
181- - " linux/amd64"
182- - " linux/amd64,linux/arm64"
183-
184-
185- env :
186- VERSION : ${{ github.event.inputs.version }}
187- SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
188- ARCH : ${{ github.event.inputs.container_arch }}
189-
190- jobs :
191- owner_check :
192- if : github.repository_owner == 'cloudforet-io'
193- runs-on : ubuntu-latest
194- steps :
195- - run : echo ${{ github.repository_owner }}
196- condition_check :
197- if : github.repository_owner == 'cloudforet-io'
198- runs-on : ubuntu-latest
199- needs : owner_check
200- steps :
201- - name : check version format
202- run : |
203- if [[ !(${{ env.VERSION }} =~ ^[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9]$) ]];
204- then
205- echo "You entered an incorrect version format."
206- exit 1
207- fi
208- - name : debugging
209- run : |
210- echo "major=$(echo ${{env.VERSION}} | cut -c 2- | cut -d'.' -f1)"
211- echo "minor=$(echo ${{env.VERSION}} | cut -c 2- | cut -d'.' -f2)"
212- echo "patch=$(echo ${{env.VERSION}} | cut -c 2- | cut -d'.' -f3)"
213- - name : notice when job fails
214- if : failure()
215- uses : 8398a7/action-slack@v3.2.0
216- with :
217- status : ${{job.status}}
218- fields : repo,workflow,job
219- author_name : Github Action Slack
220-
221- update_master_branch_version_file :
222- needs : condition_check
223- runs-on : ubuntu-latest
224- steps :
225- - uses : actions/checkout@v2
226- with :
227- token : ${{ secrets.PAT_TOKEN }}
228- - name : update version file # That is used where the master_push actions
229- run : |
230- echo ${{ env.VERSION }} > src/VERSION
231- git config user.name github-actions
232- git config user.email github-actions@github.com
233- git add .
234- git commit -m "[CI/CD] release version ${{ env.VERSION }}"
235- - name : push changes
236- uses : ad-m/github-push-action@master
237- with :
238- github_token : ${{ secrets.PAT_TOKEN }}
239- branch : master
240- - name : notice when job fails
241- if : failure()
242- uses : 8398a7/action-slack@v3.2.0
243- with :
244- status : ${{job.status}}
245- fields : repo,workflow,job
246- author_name : Github Action Slack
247-
248- tagging :
249- needs : update_master_branch_version_file
250- runs-on : ubuntu-latest
251- steps :
252- - uses : actions/checkout@v2
253- with :
254- token : ${{ secrets.PAT_TOKEN }}
255- - name : git tagging
256- run : |
257- git tag ${{ env.VERSION }}
258- git push origin "${{ env.VERSION }}"
259- - name : notice when job fails
260- if : failure()
261- uses : 8398a7/action-slack@v3.2.0
262- with :
263- status : ${{job.status}}
264- fields : repo,workflow,job
265- author_name : Github Action Slack
266-
267- docker :
268- needs : tagging
269- runs-on : ubuntu-latest
270- steps :
271- - name : Checkout
272- uses : actions/checkout@v3
273- with :
274- token : ${{ secrets.PAT_TOKEN }}
275-
276- - name : get service name
277- run : |
278- echo "SERVICE=$(echo ${{ github.repository }} | cut -d '/' -f2)" >> $GITHUB_ENV
279-
280- - name : Set up QEMU
281- uses : docker/setup-qemu-action@v2
282-
283- - name : Set up Docker Buildx
284- uses : docker/setup-buildx-action@v2
285-
286- - name : Login to Docker Hub
287- uses : docker/login-action@v2
288- with :
289- username : ${{ secrets.DOCKER_USERNAME }}
290- password : ${{ secrets.DOCKER_PASSWORD }}
291-
292- - name : Build and push to pyengine
293- uses : docker/build-push-action@v4
294- with :
295- context : .
296- platforms : ${{ env.ARCH }}
297- push : true
298- tags : pyengine/${{ env.SERVICE }}:${{ env.VERSION }}
299-
300- - name : Login to Docker Hub
301- uses : docker/login-action@v2
302- with :
303- username : ${{ secrets.CLOUDFORET_DEV_DOCKER_USERNAME }}
304- password : ${{ secrets.CLOUDFORET_DEV_DOCKER_PASSWORD }}
305-
306- - name : Build and push to cloudforet
307- uses : docker/build-push-action@v4
308- with :
309- context : .
310- platforms : ${{ env.ARCH }}
311- push : true
312- tags : cloudforet/${{ env.SERVICE }}:${{ env.VERSION }}
313-
314- - name : Notice when job fails
315- if : failure()
316- uses : 8398a7/action-slack@v3.2.0
317- with :
318- status : ${{job.status}}
319- fields : repo,workflow,job
320- author_name : Github Action Slack
321-
322- notification :
323- needs : docker
324- runs-on : ubuntu-latest
325- steps :
326- - name : Slack
327- if : always()
328- uses : 8398a7/action-slack@v3.2.0
329- with :
330- status : ${{job.status}}
331- fields : repo,message,commit,author,action,ref,workflow,job
332- author_name : Github Action Slack
333- name : " [Dispatch] Release"
334-
335- on :
336- workflow_dispatch :
337- inputs :
338- version :
339- description : ' enter version(x.y.z)'
340- required : true
341- default : ' 2.0.0'
342- container_arch :
343- type : choice
344- description : ' choose container architecture'
345- default : linux/amd64,linux/arm64
346- options :
347- - " linux/amd64"
348- - " linux/amd64,linux/arm64"
349-
350-
351- env :
352- VERSION : ${{ github.event.inputs.version }}
353- SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
354- ARCH : ${{ github.event.inputs.container_arch }}
355-
356- jobs :
357- owner_check :
358- if : github.repository_owner == 'cloudforet-io'
359- runs-on : ubuntu-latest
360- steps :
361- - run : echo ${{ github.repository_owner }}
362- condition_check :
363- if : github.repository_owner == 'cloudforet-io'
364- runs-on : ubuntu-latest
365- needs : owner_check
366- steps :
367- - name : check version format
368- run : |
369- if [[ !(${{ env.VERSION }} =~ ^[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9]$) ]];
370- then
371- echo "You entered an incorrect version format."
372- exit 1
373- fi
374- - name : debugging
375- run : |
376- echo "major=$(echo ${{env.VERSION}} | cut -c 2- | cut -d'.' -f1)"
377- echo "minor=$(echo ${{env.VERSION}} | cut -c 2- | cut -d'.' -f2)"
378- echo "patch=$(echo ${{env.VERSION}} | cut -c 2- | cut -d'.' -f3)"
379- - name : notice when job fails
380- if : failure()
381- uses : 8398a7/action-slack@v3.2.0
382- with :
383- status : ${{job.status}}
384- fields : repo,workflow,job
385- author_name : Github Action Slack
386-
387- update_master_branch_version_file :
388- needs : condition_check
389- runs-on : ubuntu-latest
390- steps :
391- - uses : actions/checkout@v2
392- with :
393- token : ${{ secrets.PAT_TOKEN }}
394- - name : update version file # That is used where the master_push actions
395- run : |
396- echo ${{ env.VERSION }} > src/VERSION
397- git config user.name github-actions
398- git config user.email github-actions@github.com
399- git add .
400- git commit -m "[CI/CD] release version ${{ env.VERSION }}"
401- - name : push changes
402- uses : ad-m/github-push-action@master
403- with :
404- github_token : ${{ secrets.PAT_TOKEN }}
405- branch : master
406- - name : notice when job fails
407- if : failure()
408- uses : 8398a7/action-slack@v3.2.0
409- with :
410- status : ${{job.status}}
411- fields : repo,workflow,job
412- author_name : Github Action Slack
413-
414- tagging :
415- needs : update_master_branch_version_file
416- runs-on : ubuntu-latest
417- steps :
418- - uses : actions/checkout@v2
419- with :
420- token : ${{ secrets.PAT_TOKEN }}
421- - name : git tagging
422- run : |
423- git tag ${{ env.VERSION }}
424- git push origin "${{ env.VERSION }}"
425- - name : notice when job fails
426- if : failure()
427- uses : 8398a7/action-slack@v3.2.0
428- with :
429- status : ${{job.status}}
430- fields : repo,workflow,job
431- author_name : Github Action Slack
432-
433- docker :
434- needs : tagging
435- runs-on : ubuntu-latest
436- steps :
437- - name : Checkout
438- uses : actions/checkout@v3
439- with :
440- token : ${{ secrets.PAT_TOKEN }}
441-
442- - name : get service name
443- run : |
444- echo "SERVICE=$(echo ${{ github.repository }} | cut -d '/' -f2)" >> $GITHUB_ENV
445-
446- - name : Set up QEMU
447- uses : docker/setup-qemu-action@v2
448-
449- - name : Set up Docker Buildx
450- uses : docker/setup-buildx-action@v2
451-
452- - name : Login to Docker Hub
453- uses : docker/login-action@v2
454- with :
455- username : ${{ secrets.DOCKER_USERNAME }}
456- password : ${{ secrets.DOCKER_PASSWORD }}
457-
458- - name : Build and push to pyengine
459- uses : docker/build-push-action@v4
460- with :
461- context : .
462- platforms : ${{ env.ARCH }}
463- push : true
464- tags : pyengine/${{ env.SERVICE }}:${{ env.VERSION }}
465-
466- - name : Login to Docker Hub
467- uses : docker/login-action@v2
468- with :
469- username : ${{ secrets.CLOUDFORET_DEV_DOCKER_USERNAME }}
470- password : ${{ secrets.CLOUDFORET_DEV_DOCKER_PASSWORD }}
471-
472- - name : Build and push to cloudforet
473- uses : docker/build-push-action@v4
474- with :
475- context : .
476- platforms : ${{ env.ARCH }}
477- push : true
478- tags : cloudforet/${{ env.SERVICE }}:${{ env.VERSION }}
479-
480- - name : Notice when job fails
481- if : failure()
482- uses : 8398a7/action-slack@v3.2.0
483- with :
484- status : ${{job.status}}
485- fields : repo,workflow,job
486- author_name : Github Action Slack
487-
488- notification :
489- needs : docker
490- runs-on : ubuntu-latest
491- steps :
492- - name : Slack
493- if : always()
494- uses : 8398a7/action-slack@v3.2.0
495- with :
496- status : ${{job.status}}
497- fields : repo,message,commit,author,action,ref,workflow,job
498- author_name : Github Action Slack
0 commit comments