-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (101 loc) · 3.04 KB
/
example-build-deploy-go.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
104
105
106
107
108
109
name: Build and Deploy Go to Kubernetes
on:
push:
branches: [trunk]
# pull_request:
# branches: [trunk]
concurrency:
group: '${{ github.workflow }}-${{ github.event_name }}'
cancel-in-progress: true
env:
APPLICATION_NAME: 'demo-api-go'
SYSTEM_NAME: 'core'
HELM_VALUES_PATH: '.github/test-go/deploy/values.yml'
PROJECT_FILE: '.github/test-go/go.mod'
jobs:
analyze:
name: Analyze
runs-on: elvia-runner
permissions:
actions: read
contents: read
security-events: write
steps:
- uses: 3lvia/core-github-actions-templates/analyze@trunk
build-scan:
name: Build and Scan
runs-on: elvia-runner
permissions:
contents: read
id-token: write
environment: build
steps:
- uses: 3lvia/core-github-actions-templates/build@trunk
with:
name: ${{ env.APPLICATION_NAME }}
namespace: ${{ env.SYSTEM_NAME }}
project-file: ${{ env.PROJECT_FILE }}
AZURE_CLIENT_ID: ${{ vars.ACR_CLIENT_ID }}
deploy-dev:
name: Deploy Dev
# Require all jobs below to be successful before running this job.
# Any of these can be commented out or removed if you want to deploy anyway.
needs:
- build-scan
- analyze
runs-on: elvia-runner
permissions:
contents: read
id-token: write
environment: dev
# Only on push to trunk
if: github.ref == 'refs/heads/trunk'
steps:
- uses: 3lvia/core-github-actions-templates/deploy@trunk
with:
name: ${{ env.APPLICATION_NAME }}
namespace: ${{ env.SYSTEM_NAME }}
environment: 'dev'
helm-values-path: ${{ env.HELM_VALUES_PATH }}
slack-channel: '#team-${{ env.SYSTEM_NAME }}-alerts'
AZURE_CLIENT_ID: ${{ vars.AKS_CLIENT_ID }}
deploy-test:
name: Deploy Test
# Only deploy to test after dev
needs: [deploy-dev]
runs-on: elvia-runner
permissions:
contents: read
id-token: write
environment: test
# Only on push to trunk
if: github.ref == 'refs/heads/trunk'
steps:
- uses: 3lvia/core-github-actions-templates/deploy@trunk
with:
name: ${{ env.APPLICATION_NAME }}
namespace: ${{ env.SYSTEM_NAME }}
environment: 'test'
helm-values-path: ${{ env.HELM_VALUES_PATH }}
slack-channel: '#team-${{ env.SYSTEM_NAME }}-alerts'
AZURE_CLIENT_ID: ${{ vars.AKS_CLIENT_ID }}
deploy-prod:
name: Deploy Prod
# Only deploy to prod after test
needs: [deploy-test]
runs-on: elvia-runner
permissions:
contents: read
id-token: write
environment: prod
# Only on push to trunk
if: github.ref == 'refs/heads/trunk'
steps:
- uses: 3lvia/core-github-actions-templates/deploy@trunk
with:
name: ${{ env.APPLICATION_NAME }}
namespace: ${{ env.SYSTEM_NAME }}
environment: 'prod'
helm-values-path: ${{ env.HELM_VALUES_PATH }}
slack-channel: '#team-${{ env.SYSTEM_NAME }}-alerts'
AZURE_CLIENT_ID: ${{ vars.AKS_CLIENT_ID }}