-
Notifications
You must be signed in to change notification settings - Fork 79
109 lines (94 loc) · 4 KB
/
helm_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
103
104
105
106
107
108
109
name: K8ssandra Operator Helm Release
on:
workflow_call:
inputs:
helm_repo:
description: 'Helm repository to use'
default: 'next'
required: false
type: string
prerelease:
description: 'Whether we are publishing a pre-release'
default: 'true'
required: false
type: string
secrets:
GCP_PROJECT_ID:
required: true
GCP_SA_KEY:
required: true
GCP_HELM_BUCKET_NAME:
required: true
jobs:
helm-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update PATH
run: |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: Update chart dependencies
run: |
scripts/update-helm-deps.sh
- name: Compute release chart version
id: compute_next_version
run: |
DATE_TIME=$(date '+%Y%m%d%H%M%S')
RELEASE_VERSION=$(echo $(yq e '.version' charts/k8ssandra-operator/Chart.yaml) | sed "s/-.*/-${DATE_TIME}-${GITHUB_SHA::8}/")
echo "Release version is: $RELEASE_VERSION"
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_OUTPUT
- name: Update Helm chart version
run: |
yq eval ".version |= \"${RELEASE_VERSION}\"" charts/k8ssandra-operator/Chart.yaml -i
yq eval ".appVersion |= \"${RELEASE_VERSION}\"" charts/k8ssandra-operator/Chart.yaml -i
if [ "${{ inputs.prerelease }}" == "true" ]; then
## When publishing a prerelease from the main branch, we want to use the short SHA as the image tag
yq eval ".image.tag |= \"${GITHUB_SHA::8}\"" charts/k8ssandra-operator/values.yaml -i
else
## For a release, we want to use the git tag name as the image tag
yq eval ".image.tag |= \"v${RELEASE_VERSION}\"" charts/k8ssandra-operator/values.yaml -i
fi
cat charts/k8ssandra-operator/Chart.yaml
- name: Prepare Helm release
run: |
make prepare-helm-release
- name: Create working directory and copy charts
run: |
mkdir -p build/$RELEASE_VERSION/k8ssandra-operator
cp -rv charts/* build/$RELEASE_VERSION
- name: Generate package archives
run: |
helm package k8ssandra-operator
working-directory: build/${{ steps.compute_next_version.outputs.RELEASE_VERSION }}
# Helm Release
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: 'Set up Cloud SDK'
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Download current index from Google Cloud
env:
GCP_HELM_BUCKET_NAME: ${{ secrets.GCP_HELM_BUCKET_NAME }}
run: |
echo "Downloading index.yaml from gs://$GCP_HELM_BUCKET_NAME/${{ inputs.helm_repo }}/index.yaml"
gsutil cp gs://$GCP_HELM_BUCKET_NAME/${{ inputs.helm_repo }}/index.yaml ./
working-directory: build/${{ steps.compute_next_version.outputs.RELEASE_VERSION }}
- name: Regenerate Helm index
env:
GCP_HELM_BUCKET_NAME: ${{ secrets.GCP_HELM_BUCKET_NAME }}
run: |
echo "Generating Helm index for gs://$GCP_HELM_BUCKET_NAME/${{ inputs.helm_repo }}/index.yaml"
helm repo index . --merge index.yaml --url "https://$GCP_HELM_BUCKET_NAME/${{ inputs.helm_repo }}/"
working-directory: build/${{ steps.compute_next_version.outputs.RELEASE_VERSION }}
- name: Upload packages and index
env:
GCP_HELM_BUCKET_NAME: ${{ secrets.GCP_HELM_BUCKET_NAME }}
run: |
gsutil cp ./*.tgz gs://$GCP_HELM_BUCKET_NAME/${{ inputs.helm_repo }}/
gsutil cp ./index.yaml gs://$GCP_HELM_BUCKET_NAME/${{ inputs.helm_repo }}/
working-directory: build/${{ steps.compute_next_version.outputs.RELEASE_VERSION }}