Repository navigation
59 lines (51 loc) · 1.89 KB
/
Copy path_helm.yml
File metadata and controls
59 lines (51 loc) · 1.89 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
on:
workflow_call:
inputs:
publish:
type: boolean
description: If true, pushes the chart to the OCI registry (tags only)
env:
HELM_VERSION_TO_INSTALL: 3.17.1
jobs:
chart:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install helm
uses: Azure/setup-helm@v5
with:
version: ${{ env.HELM_VERSION_TO_INSTALL }}
# Chart versions must be semver. An early check saves waiting for the
# whole build before finding a problem.
- name: Check helm version tag
if: github.ref_type == 'tag'
env:
VERSION: ${{ github.ref_name }}
run: |
if [[ "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+((-alpha|-beta|-rc)\.[0-9]+)?$ ]]; then
echo "Valid version format: '${VERSION}'"
else
echo "Invalid version: '${VERSION}'. Expected: 'X.Y.Z' or 'X.Y.Z-beta.1'"
exit 1
fi
- name: Lint and render chart
run: |
helm lint Charts/tiled
helm template tiled Charts/tiled > /dev/null
# The chart version and appVersion are both the git tag. appVersion is the
# default image tag, so a chart release deploys the image of the same tag.
- name: Package helm chart
env:
VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '0.0.0' }}
run: |
helm package --version "${VERSION}" --app-version "${VERSION}" Charts/tiled
- name: Push tagged helm chart to registry
if: inputs.publish && github.ref_type == 'tag'
env:
OWNER: ${{ github.repository_owner }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "${TOKEN}" | helm registry login ghcr.io --username "${OWNER}" --password-stdin
REGISTRY="oci://ghcr.io/${OWNER}/charts"
helm push tiled-*.tgz "${REGISTRY,,}"