forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathci-publish-cloud-helm-chart.yaml
More file actions
59 lines (51 loc) · 2.13 KB
/
ci-publish-cloud-helm-chart.yaml
File metadata and controls
59 lines (51 loc) · 2.13 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
defaults:
run:
shell: bash
env:
CHART_VERSION: "0.0.0"
GAR_REPOSITORY: "us-central1-docker.pkg.dev/liferay-artifact-registry/liferay-helm-chart"
jobs:
publish-cloud-helm-chart:
if: (github.repository == 'liferay/liferay-portal')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- env:
GITHUB_TOKEN: ${{ github.token }}
name: Verify Helm chart version
run: |
CHART_VERSION=$(cat ./Chart.yaml | yq .version)
echo "Verifying Helm chart version ${CHART_VERSION}."
if helm show readme "oci://${GAR_REPOSITORY}/liferay:${CHART_VERSION}" >/dev/null 2>&1
then
echo "Skipping Helm Chart version ${CHART_VERSION}."
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }} >/dev/null
exit 1
else
echo "Verified Helm Chart version ${CHART_VERSION}."
fi
echo "CHART_VERSION=${CHART_VERSION}" >> ${GITHUB_ENV}
working-directory: ./cloud/helm
- name: Package Helm chart
run: |
mkdir "${{ runner.temp }}/dist"
helm package --destination "${{ runner.temp }}/dist" --version ${CHART_VERSION} .
working-directory: ./cloud/helm
- name: Log in to GAR
run: echo "${{ secrets.GAR_PASSWORD }}" | helm registry login ${GAR_REPOSITORY} --password-stdin --username _json_key_base64
- name: Push Helm chart to GAR
run: |
for file_name in *.tgz
do
echo "Pushing ${file_name}."
helm push "${file_name}" "oci://${GAR_REPOSITORY}"
done
working-directory: ${{ runner.temp }}/dist
on:
push:
branches:
- master
paths:
- cloud/**