-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (39 loc) · 1.16 KB
/
template-deployment.yml
File metadata and controls
50 lines (39 loc) · 1.16 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
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: show sha
run: echo "sha - ${{ github.sha }}"
- name: build docker image
run: docker build -t ${{ inputs.image_name }}:latest -t ${{ inputs.image_name }}:${{ github.sha }} .
- 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 }}:${{ github.sha }}
- name: deploy webhook
run: curl --max-time 20 -X POST ${{ secrets[inputs.deploy_url_secret] }}