-
Notifications
You must be signed in to change notification settings - Fork 314
88 lines (71 loc) · 3.21 KB
/
publish-chart.yaml
File metadata and controls
88 lines (71 loc) · 3.21 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
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
name: Publish Helm Chart to GHCR
on:
push:
tags:
- 'chart/v*'
env:
REGISTRY: ghcr.io
CHART_NAME: acontext
CHART_PATH: charts/acontext
HELM_VERSION: v4.0.1
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
- name: Resolve parameters
id: resolve_parameters
env:
REPO_OWNER: ${{ github.repository_owner }}
run: |
echo "INFO: Normalizing repository name (lowercase)"
echo "repository_owner=$(echo "$REPO_OWNER" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
- name: Set up Helm
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2
with:
version: ${{ env.HELM_VERSION }}
- name: Package Helm chart
run: |
helm dependency update "${{ env.CHART_PATH }}"
- name: Verify version matches tag
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/chart/v}
CHART_VERSION=$(grep '^version:' "${{ env.CHART_PATH }}/Chart.yaml" | cut -d ' ' -f 2)
if [ "$TAG_VERSION" != "$CHART_VERSION" ]; then
echo "Tag version ($TAG_VERSION) does not match Chart.yaml version ($CHART_VERSION)"
exit 1
fi
- name: Publish new helm chart for acontext
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_ACTOR: ${{ github.actor }}
run: |
echo "$GH_TOKEN" | helm registry login ghcr.io --username "$GH_ACTOR" --password-stdin
ACONEXT_CHART_VERSION_TAG=$(grep '^version:' "${{ env.CHART_PATH }}/Chart.yaml" | cut -d " " -f 2)
echo "ACONEXT_CHART_VERSION_TAG=${ACONEXT_CHART_VERSION_TAG}" >> "$GITHUB_ENV"
helm package "${{ env.CHART_PATH }}/" --version="${ACONEXT_CHART_VERSION_TAG}"
helm push "${{ env.CHART_NAME }}-${ACONEXT_CHART_VERSION_TAG}.tgz" "oci://ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/helm-charts"
- name: Output chart location
run: |
echo "Chart published to: ${{ env.REGISTRY }}/${{ steps.resolve_parameters.outputs.repository_owner }}/helm-charts/${{ env.CHART_NAME }}:${ACONEXT_CHART_VERSION_TAG}"
echo "Install with: helm install my-release oci://${{ env.REGISTRY }}/${{ steps.resolve_parameters.outputs.repository_owner }}/helm-charts/${{ env.CHART_NAME }} --version ${ACONEXT_CHART_VERSION_TAG}"
- name: Generate Changelog
run: |
CHART_VERSION=${GITHUB_REF#refs/tags/chart/v}
bash .github/scripts/generate-changelog.sh \
--tag-prefix "chart/v" \
--source-dir "charts/acontext" \
--display-name "Helm Chart" \
--output "${{ github.workspace }}-CHANGELOG.txt" \
--footer "Published to ghcr.io OCI registry. Install with: helm install my-release oci://ghcr.io/memodb-io/helm-charts/acontext --version ${CHART_VERSION}"
- name: Create Release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda
with:
body_path: ${{ github.workspace }}-CHANGELOG.txt