-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (46 loc) · 1.45 KB
/
template-deployment.yml
File metadata and controls
59 lines (46 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: pipeline ci/cd — trigger deployment
on:
workflow_call:
inputs:
service_path:
required: true
type: string
image_name:
required: true
type: string
deploy_url_secret:
required: true
type: string
jobs:
deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ inputs.service_path }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup gitversion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
- name: semantic versioning
uses: gittools/actions/gitversion/execute@v0
id: gitversion
- name: show version
run: echo "version - ${{ steps.gitversion.outputs.semVer }}"
- name: build docker image
run: docker build -t ${{ inputs.image_name }}:latest -t ${{ inputs.image_name }}:${{ steps.gitversion.outputs.semVer }} .
- name: login docker hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: push docker image
run: |
docker push ${{ inputs.image_name }}:latest
docker push ${{ inputs.image_name }}:${{ steps.gitversion.outputs.semVer }}
- name: deploy webhook
run: curl -X POST ${{ secrets[inputs.deploy_url_secret] }}