-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (85 loc) · 2.66 KB
/
release.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
86
87
88
89
90
91
92
93
94
95
96
97
name: Release
on:
workflow_dispatch:
push:
branches:
- master
paths:
- charts/**
permissions:
contents: write
packages: write
pages: write
id-token: write
concurrency:
group: release
cancel-in-progress: false
jobs:
release-charts:
name: Release Charts
runs-on: ubuntu-latest
env:
AUTHOR_USER: plcnk-bot
AUTHOR_EMAIL: 178334506+plcnk-bot[bot]@users.noreply.github.com
steps:
- name: Generate Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "${{ env.AUTHOR_USER }}"
git config user.email "${{ env.AUTHOR_EMAIL }}"
- name: Add Helm repos
run: |
helm repo add bjw-s https://bjw-s.github.io/helm-charts
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Install chart-releaser
uses: helm/[email protected]
with:
install_only: true
- name: Package charts
id: package_charts
run: |
changed_charts=""
for dir in charts/*; do
chart_name="$(basename "$dir")"
version="$(yq '.version' "$dir/Chart.yaml")"
if ! git rev-parse "$chart_name-${version#v}" &>/dev/null; then
echo "Packaging chart $chart_name..."
cr package --package-path=.cr-release-packages "$dir"
changed_charts+="$chart_name,"
fi
done
echo "changed_charts=${changed_charts%,}" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: steps.package_charts.outputs.changed_charts != ''
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Push charts to GHCR
if: steps.package_charts.outputs.changed_charts != ''
run: |
for pkg in .cr-release-packages/*; do
if [ -z "${pkg:-}" ]; then
break
fi
echo "Pushing $pkg..."
helm push "$pkg" "oci://ghcr.io/$GITHUB_REPOSITORY_OWNER/charts"
done
- name: Publish charts
uses: helm/[email protected]
if: steps.package_charts.outputs.changed_charts != ''
with:
config: .github/cr-config.yaml
skip_packaging: true
env:
CR_TOKEN: ${{ steps.app-token.outputs.token }}