forked from sapcc/helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (72 loc) · 2.63 KB
/
helm-push-input.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
name: Package and publish Helm chart to GHCR with input
on:
workflow_dispatch:
inputs:
chartDir:
description: 'Directory containing the Helm chart to package and publish'
required: true
type: string
chartName:
description: 'Name of the Helm chart to package and publish(optional)'
required: false
type: string
dry-run:
description: 'Run the workflow without pushing the Helm chart to the registry'
type: boolean
required: false
permissions:
contents: write
packages: write
env:
REGISTRY: ghcr.io
ACTIONS_RUNNER_DEBUG: false
jobs:
helm-release:
runs-on: [ ubuntu-latest ]
steps:
- name: Print inputs
run: |
echo "chartDir: ${{ inputs.chartDir }}"
echo "chartName: ${{ inputs.chartName }}"
echo "dry-run: ${{ inputs.dry-run }}"
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Set up Helm
uses: azure/setup-helm@v4.2.0
- uses: actions/setup-python@v5
with:
python-version: 3.9
check-latest: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1
- name: Run chart-testing (lint)
run: ct lint --chart-yaml-schema ci/chart_schema.yaml --lint-conf ci/lintconf.yaml --config ci/config.yaml --since HEAD~1 --chart-dirs ${{ inputs.chartDir }}
- name: Push Charts to GHCR
run: |
helm dependency update ${{ inputs.chartDir }}
helm package ${{ inputs.chartDir }} -d ${{ inputs.chartDir }}
PKG_NAME=`ls ${{ inputs.chartDir }}/*.tgz`
if [ ${{ inputs.chartName }} ]; then
mv ${PKG_NAME} ${{ inputs.chartDir }}/${{ inputs.chartName }}.tgz
PKG_NAME=${{ inputs.chartName }}
fi
if [ ${{ inputs.dry-run }} == 'true' ]; then
echo "Dry run: Skipping push of $PKG_NAME"
exit 0
else
helm push ${PKG_NAME} oci://${{ env.REGISTRY }}/${{ github.repository }}/
fi