-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
72 lines (69 loc) · 2.34 KB
/
action.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
name: Helm Package Push
description: Action to package a helm chart and push it to the chart repo
inputs:
dev:
description: Whether to create a development chart
required: false
default: "false"
acr-client-id:
description: Azure Container Registry client id
required: true
acr-password:
description: Azure Container Registry client secret
required: true
push:
description: Push the chart to the chart repo
required: false
default: "true"
app-version:
description: The version of the application
required: false
default: ""
working-dir:
description: The working directory of the project
required: false
default: "."
outputs:
chart-name:
description: The name of the chart
value: ${{ steps.set-output.outputs.chart-name }}
chart-version:
description: The version of the chart
value: ${{ steps.set-output.outputs.chart-version }}
runs:
using: composite
steps:
- name: Login to Azure Container Repository
run: |
helm registry login beezlabs.azurecr.io --username ${{ inputs.acr-client-id }} --password ${{ inputs.acr-password }}
shell: bash
- name: Set chart version
run: |
if [ "${{ inputs.dev }}" == "true" ]; then
echo "CHART_VERSION=$(yq -e '.version' './charts/Chart.yaml')-${{ github.sha }}" >> $GITHUB_ENV
else
echo "CHART_VERSION=$(yq -e '.version' './charts/Chart.yaml')" >> $GITHUB_ENV
fi
echo "CHART_NAME=$(yq -e '.name' './charts/Chart.yaml')" >> $GITHUB_ENV
working-directory: ${{ inputs.working-dir }}
shell: bash
- name: Set output
id: set-output
run: |
echo "chart-name=$(echo $CHART_NAME)" >> $GITHUB_OUTPUT
echo "chart-version=$(echo $CHART_VERSION)" >> $GITHUB_OUTPUT
shell: bash
- name: Build, package and push Helm chart
run: |
cd charts
helm dependency build
if [ "${{ inputs.app-version }}" == "" ]; then
helm package . --version "$CHART_VERSION"
else
helm package . --app-version ${{ inputs.app-version }} --version "$CHART_VERSION"
fi
if [ "${{ inputs.push }}" == "true" ]; then
helm push "$CHART_NAME"-"$CHART_VERSION".tgz oci://beezlabs.azurecr.io/charts/beezlabs
fi
working-directory: ${{ inputs.working-dir }}
shell: bash