-
Notifications
You must be signed in to change notification settings - Fork 9
85 lines (69 loc) · 2.42 KB
/
Copy pathargocd-understack-release.yaml
File metadata and controls
85 lines (69 loc) · 2.42 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
---
name: argocd-understack release
on:
push:
tags:
- "argocd-understack-v*.*.*"
workflow_dispatch:
inputs:
chart_version:
description: "Chart version to release (e.g., 0.1.0)"
required: true
type: string
permissions:
contents: read
packages: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5
with:
version: v3.18.4
- name: Install Cosign
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
- name: Extract version from tag or input
id: version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION="${{ inputs.chart_version }}"
else
VERSION=${GITHUB_REF#refs/tags/argocd-understack-v}
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Helm lint
run: |
helm lint charts/argocd-understack --strict
- name: Package chart
run: |
VERSION="${{ steps.version.outputs.version }}"
helm package charts/argocd-understack --version "$VERSION"
- name: Login to GitHub Container Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push chart to GHCR
run: |
VERSION="${{ steps.version.outputs.version }}"
CHART_PACKAGE="argocd-understack-${VERSION}.tgz"
if [[ ! -f "$CHART_PACKAGE" ]]; then
echo "::error::Chart package $CHART_PACKAGE not found"
ls -la *.tgz
exit 1
fi
helm push "$CHART_PACKAGE" oci://ghcr.io/${{ github.repository }}
echo "::notice::Chart pushed to oci://ghcr.io/${{ github.repository }}/argocd-understack:${VERSION}"
- name: Sign chart with Cosign
run: |
VERSION="${{ steps.version.outputs.version }}"
cosign sign --yes ghcr.io/${{ github.repository }}/argocd-understack:${VERSION}
echo "::notice::Chart signed with keyless signature"
- name: Logout from GHCR
if: always()
run: |
helm registry logout ghcr.io