-
Notifications
You must be signed in to change notification settings - Fork 10
122 lines (102 loc) · 3.34 KB
/
ci-build.yml
File metadata and controls
122 lines (102 loc) · 3.34 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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
types: [ opened, reopened, synchronize ]
workflow_call:
inputs:
platforms:
description: 'Platforms to build for'
required: false
type: string
latest:
description: 'Tag image as latest'
required: false
type: boolean
default: false
workflow_dispatch:
name: ci-build
env:
REGISTRY: ghcr.io
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run Common Unit Tests
uses: ./.github/actions/test-app
with:
dockerfile: docker/Base.Dockerfile
image: test-common
target: test-common
- name: Run API Integration Tests
uses: ./.github/actions/test-app
with:
dockerfile: docker/API.Dockerfile
image: api-integration-tests
target: integration-test-api
- name: Build API
uses: ./.github/actions/build-app
with:
dockerfile: docker/API.Dockerfile
push: ${{ github.ref_protected && github.event_name != 'pull_request' }}
image: api
platforms: ${{ inputs.platforms || 'linux/amd64' }}
latest: ${{ inputs.latest || false }}
- name: Build LiveControlGateway
uses: ./.github/actions/build-app
with:
dockerfile: docker/LiveControlGateway.Dockerfile
push: ${{ github.ref_protected && github.event_name != 'pull_request' }}
image: live-control-gateway
platforms: ${{ inputs.platforms || 'linux/amd64' }}
latest: ${{ inputs.latest || false }}
- name: Build Cron
uses: ./.github/actions/build-app
with:
dockerfile: docker/Cron.Dockerfile
push: ${{ github.ref_protected && github.event_name != 'pull_request' }}
image: cron
platforms: ${{ inputs.platforms || 'linux/amd64' }}
latest: ${{ inputs.latest || false }}
deploy-dev:
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref_type == 'branch' && github.event_name != 'pull_request' && github.ref_name == 'develop' }}
environment: development
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
- uses: ./.github/actions/watchtower-update
with:
url: ${{ vars.WATCHTOWER_URL }}
token: ${{ secrets.WATCHTOWER_TOKEN }}
deploy-production:
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref_type == 'branch' && github.event_name != 'pull_request' && github.ref_name == 'master' }}
environment: production
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
- uses: ./.github/actions/kubernetes-rollout-restart
with:
apiurl: ${{ secrets.KUBERNETES_APIURL }}
token: ${{ secrets.KUBERNETES_TOKEN }}
deployments: ${{ vars.DEPLOYMENT_NAMES }}