-
Notifications
You must be signed in to change notification settings - Fork 125
103 lines (99 loc) · 3.02 KB
/
docker.yml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Docker
on:
push:
branches:
- master
- release/*
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-beta'
- 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
pull_request:
branches:
- master
jobs:
build:
name: build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Dev image
run: make dev-image
- name: Prod image
run: make prod-image
- name: List images
run: docker images
deploy-latest:
name: deploy latest
needs: build
runs-on: ubuntu-20.04
if: github.event_name == 'push' && contains(github.ref, 'master')
steps:
- uses: actions/checkout@v3
- name: Dev image
run: make dev-image
- name: Prod image
run: make prod-image
- name: Tag images
run: |
docker tag dev_vpp_agent ligato/dev-vpp-agent:latest
docker tag prod_vpp_agent ligato/vpp-agent:latest
- name: Docker Login
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Push images
run: |
docker push ligato/vpp-agent:latest
deploy-tag:
name: deploy version
needs: build
runs-on: ubuntu-20.04
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- name: Dev image
run: make dev-image
- name: Prod image
run: make prod-image
- name: Get tag
id: vars
run: |
echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
echo ::group::Env vars
echo $(env | sort)
echo ::endgroup::
- name: Tag images
run: |
docker tag dev_vpp_agent ligato/dev-vpp-agent:${{ steps.vars.outputs.tag }}
docker tag prod_vpp_agent ligato/vpp-agent:${{ steps.vars.outputs.tag }}
- name: Docker Login
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Push images
run: |
docker push ligato/vpp-agent:${{ steps.vars.outputs.tag }}
deploy-release:
name: deploy release
needs: build
runs-on: ubuntu-20.04
if: github.event_name == 'push' && contains(github.ref, 'release/')
steps:
- uses: actions/checkout@v3
- name: Dev image
run: make dev-image
- name: Prod image
run: make prod-image
- name: Get tag
id: vars
run: |
echo ::set-output name=tag::$(echo ${GITHUB_REF:19:22})
echo ::group::Env vars
echo $(env | sort)
echo ::endgroup::
- name: Tag images
run: |
docker tag dev_vpp_agent ligato/dev-vpp-agent:${{ steps.vars.outputs.tag }}
docker tag prod_vpp_agent ligato/vpp-agent:${{ steps.vars.outputs.tag }}
- name: Docker Login
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Push images
run: |
docker push ligato/vpp-agent:${{ steps.vars.outputs.tag }}