-
Notifications
You must be signed in to change notification settings - Fork 21
102 lines (90 loc) · 3.72 KB
/
release.yaml
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
name: Publish images
on:
push:
branches:
- main
- 'release/**'
jobs:
build:
name: Publish on container registry
runs-on: ubuntu-22.04
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Get release version
if: startsWith(github.ref_name, 'release')
uses: actions-ecosystem/action-regex-match@v2
id: release-version
with:
text: ${{ github.ref_name }}
regex: '^release\/v(.*)$'
- name: Get fallback release version from chart
id: fallback-release-version
run: |
echo "FALLBACK_RELEASE_VERSION=$(grep 'appVersion' chart/Chart.yaml | cut -d " " -f2)" >> $GITHUB_ENV
- name: Set build time
run: echo "BUILD_TIME=$(date +%s)" >> $GITHUB_ENV
- name: Set image tag if no release
run: |
echo "IMAGE_TAG=${{ env.FALLBACK_RELEASE_VERSION }}-${{ env.BUILD_TIME }}" >> $GITHUB_ENV
- name: Set image release tag
if: ${{ steps.release-version.outputs.match != '' }}
run: |
echo "IMAGE_TAG=${{ steps.release-version.outputs.group1 }}" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ vars.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache layers
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/.skaffold/cache"
key: skaffold-${{ hashFiles('**/cache') }}
restore-keys: |
skaffold-
- name: Run Skaffold build pipeline
uses: hiberbee/[email protected]
id: build
with:
command: build
skip-tests: true
tag: ${{ env.IMAGE_TAG }}
repository: ${{ vars.REGISTRY }}/${{ github.repository }}
push: true
- name: Update helm image tags
uses: fjogeleit/yaml-update-action@main
with:
valueFile: 'chart/values.yaml'
commitChange: false
changes: |
{
"userSimulator.cronJob.jobTemplate.container.image.tag": "${{ env.IMAGE_TAG }}",
"maliciousLoadGenerator.deployment.container.image.tag": "${{ env.IMAGE_TAG }}",
"likeService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}",
"paymentService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}",
"profileService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}",
"membershipService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}",
"userAuthService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}",
"adService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}",
"envoyProxy.deployment.container.image.tag": "${{ env.IMAGE_TAG }}",
"microblogService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}",
"statusService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}",
"proxyService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}",
"frontend.deployment.container.image.tag": "${{ env.IMAGE_TAG }}"
}
- name: Update helm chart appVersion / version
uses: fjogeleit/yaml-update-action@main
with:
valueFile: 'chart/Chart.yaml'
commitChange: false
changes: |
{
"appVersion": "${{ env.IMAGE_TAG }}",
"version": "${{ env.IMAGE_TAG }}"
}
- name: Publish Helm chart to GHCR
run: |
helm package chart
helm push unguard-${{ env.IMAGE_TAG }}.tgz oci://${{ vars.REGISTRY }}/${{ github.repository }}/chart