-
Notifications
You must be signed in to change notification settings - Fork 9
162 lines (142 loc) · 4.7 KB
/
release-charts.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Helm Chart release
permissions:
contents: write
packages: write
id-token: write
on:
workflow_call:
inputs:
latest:
required: false
type: boolean
default: false
registry:
required: true
type: string
images_tag:
required: true
type: string
description: 'The images tags to patch the chart with'
chart_tag:
required: true
type: string
description: 'Chart release tag'
secrets:
CR_TOKEN:
description: 'The GitHub token to use for the helm chart release'
required: true
workflow_dispatch:
inputs:
latest:
required: false
type: boolean
default: false
registry:
type: choice
options:
- 'docker.io'
- 'ghcr.io'
default: 'docker.io'
description: 'The docker registry to use for the images'
images_tag:
required: true
type: string
description: 'The images tags to patch the chart with'
chart_tag:
required: true
type: string
description: 'The helm chart tag to release the chart'
jobs:
helm-chart-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Install pre-requisites
uses: ./.github/actions/setup
- name: Install Helm
uses: azure/setup-helm@v4
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- uses: imranismail/setup-kustomize@v2
- name: Prepare CRD chart
run: ./gradlew prepareCRDsChart
- name: Prepare operator chart
run: ./gradlew prepareOperatorChart
- name: Get Docker Repository Name
id: docker_repo
uses: ./.github/actions/repository
with:
repository: ${{ github.repository_owner }}
registry: ${{ inputs.registry }}
- name: Override image tags
uses: ./.github/actions/update-yaml
with:
file: 'operator/charts/paladin-operator/values.yaml'
updates: |
operator:
image:
repository: ${{ inputs.registry }}/${{ steps.docker_repo.outputs.repository }}/paladin-operator
tag: ${{ inputs.images_tag }}
paladin:
image:
repository: ${{ inputs.registry }}/${{ steps.docker_repo.outputs.repository }}/paladin
tag: ${{ inputs.images_tag }}
# Remove 'v' prefix from the tag
- name: Process Tag
shell: bash
run: |
TAG="${{ inputs.chart_tag }}"
PROCESSED_TAG="${TAG#v}"
echo "PROCESSED_TAG=${PROCESSED_TAG}" >> $GITHUB_ENV
# Override the chart version in the Chart.yaml file
- name: Override chart version
uses: ./.github/actions/update-yaml
with:
file: 'operator/charts/paladin-operator/Chart.yaml'
updates: |
version: ${{ env.PROCESSED_TAG }}
appVersion: ${{ inputs.chart_tag }}
- name: Confirm Helm templates
working-directory: operator/charts/paladin-operator
run: |
helm dependency build
helm template .
rm -rf charts
rm Chart.lock
# TODO: Add e2e tests for the helm chart
# set CR_TOKEN env with the GitHub token secret when it is workflow_dispatch action
- name: Set CR_TOKEN
shell: bash
run: |
if [ "${{ github.event_name }}" == 'workflow_call' ]; then
echo "CR_TOKEN=${{ secrets.CR_TOKEN }}" >> $GITHUB_ENV
else
echo "CR_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
fi
- name: Run chart-releaser
uses: helm/[email protected]
with:
mark_as_latest: false # the release is marked as latest in the next step
charts_dir: "operator/charts"
skip_existing: true
env:
CR_TOKEN: "${{ env.CR_TOKEN }}"
- name: Prepare CRs artifacts
run: ./gradlew prepareArtifacts -PartifactDir=${{ github.workspace }}/artifacts
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.chart_tag }}
body: "Release ${{ inputs.chart_tag }}"
generate_release_notes: true
make_latest: ${{ inputs.latest }}
files: |
${{ github.workspace }}/artifacts/basenet.yaml
${{ github.workspace }}/artifacts/devnet.yaml
${{ github.workspace }}/artifacts/artifacts.tar.gz