Skip to content

Commit 3cc34b0

Browse files
authored
feat: Add release charts workflow (#1140)
* feat: Add release charts workflow Signed-off-by: Ludovic Ortega <[email protected]> * fix: helm workflow Signed-off-by: Ludovic Ortega <[email protected]> * fix: artifacthub file location Signed-off-by: Ludovic Ortega <[email protected]> * feat: bump chart to 1.2.0 Signed-off-by: Ludovic Ortega <[email protected]> * fix: documentation build Signed-off-by: Ludovic Ortega <[email protected]> * fix: install oras in first job Signed-off-by: Ludovic Ortega <[email protected]> * fix: release workflow Signed-off-by: Ludovic Ortega <[email protected]> * fix: release workflow add package read permission Signed-off-by: Ludovic Ortega <[email protected]> * fix: login to ghcr.io at the beginning of job Signed-off-by: Ludovic Ortega <[email protected]> * fix: avoid exiting on oras discover Signed-off-by: Ludovic Ortega <[email protected]> * fix: documentation typo * feat: prepare for release Signed-off-by: Ludovic Ortega <[email protected]> * fix: remove myself from codeowners Signed-off-by: Ludovic Ortega <[email protected]> --------- Signed-off-by: Ludovic Ortega <[email protected]>
1 parent 5a32332 commit 3cc34b0

File tree

17 files changed

+164
-5
lines changed

17 files changed

+164
-5
lines changed

.github/workflows/helm.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Release Charts
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
package-helm-chart:
10+
name: Package helm chart
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: read
15+
outputs:
16+
has_artifacts: ${{ steps.check-artifacts.outputs.has_artifacts }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Install helm
24+
uses: azure/setup-helm@v4
25+
26+
- name: Install Oras
27+
uses: oras-project/setup-oras@v1
28+
29+
- name: Login to GitHub Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Package helm charts
37+
run: |
38+
mkdir -p ./.cr-release-packages
39+
for chart_path in ./charts/*; do
40+
if [ -d "$chart_path" ] && [ -f "$chart_path/Chart.yaml" ]; then
41+
chart_name=$(grep '^name:' "$chart_path/Chart.yaml" | awk '{print $2}')
42+
# get current version
43+
current_version=$(grep '^version:' "$chart_path/Chart.yaml" | awk '{print $2}')
44+
# try to get current release version
45+
set +e
46+
oras discover ghcr.io/${GITHUB_REPOSITORY@L}/${chart_name}:${current_version}
47+
oras_exit_code=$?
48+
set -e
49+
50+
if [ $oras_exit_code -ne 0 ]; then
51+
helm dependency build "$chart_path"
52+
helm package "$chart_path" --destination ./.cr-release-packages
53+
else
54+
echo "No version change for $chart_name. Skipping."
55+
fi
56+
else
57+
echo "Skipping $chart_name: Not a valid Helm chart"
58+
fi
59+
done
60+
61+
- name: Check if artifacts exist
62+
id: check-artifacts
63+
run: |
64+
if ls .cr-release-packages/* >/dev/null 2>&1; then
65+
echo "has_artifacts=true" >> $GITHUB_OUTPUT
66+
else
67+
echo "has_artifacts=false" >> $GITHUB_OUTPUT
68+
fi
69+
70+
- name: Upload artifacts
71+
uses: actions/upload-artifact@v4
72+
if: steps.check-artifacts.outputs.has_artifacts == 'true'
73+
with:
74+
name: artifacts
75+
include-hidden-files: true
76+
path: .cr-release-packages/
77+
78+
publish:
79+
name: Publish to ghcr.io
80+
runs-on: ubuntu-latest
81+
permissions:
82+
packages: write # needed for pushing to github registry
83+
id-token: write # needed for signing the images with GitHub OIDC Token
84+
needs: [package-helm-chart]
85+
if: needs.package-helm-chart.outputs.has_artifacts == 'true'
86+
steps:
87+
- name: Checkout
88+
uses: actions/checkout@v4
89+
with:
90+
fetch-depth: 0
91+
92+
- name: Install helm
93+
uses: azure/setup-helm@v4
94+
95+
- name: Install Oras
96+
uses: oras-project/setup-oras@v1
97+
98+
- name: Install Cosign
99+
uses: sigstore/cosign-installer@v3
100+
101+
- name: Downloads artifacts
102+
uses: actions/download-artifact@v4
103+
with:
104+
name: artifacts
105+
path: .cr-release-packages/
106+
107+
- name: Login to GitHub Container Registry
108+
uses: docker/login-action@v3
109+
with:
110+
registry: ghcr.io
111+
username: ${{ github.actor }}
112+
password: ${{ secrets.GITHUB_TOKEN }}
113+
114+
- name: Push charts to GHCR
115+
env:
116+
COSIGN_YES: true
117+
run: |
118+
for chart_path in `find .cr-release-packages -name '*.tgz' -print`; do
119+
# push chart to OCI
120+
chart_release_file=$(basename "$chart_path")
121+
chart_name=${chart_release_file%-*}
122+
helm push ${chart_path} oci://ghcr.io/${GITHUB_REPOSITORY@L} |& tee helm-push-output.log
123+
chart_digest=$(awk -F "[, ]+" '/Digest/{print $NF}' < helm-push-output.log)
124+
# sign chart
125+
cosign sign "ghcr.io/${GITHUB_REPOSITORY@L}/${chart_name}@${chart_digest}"
126+
# push artifacthub-repo.yml to OCI
127+
oras push \
128+
ghcr.io/${GITHUB_REPOSITORY@L}/${chart_name}:artifacthub.io \
129+
--config /dev/null:application/vnd.cncf.artifacthub.config.v1+yaml \
130+
charts/$chart_name/artifacthub-repo.yml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml \
131+
|& tee oras-push-output.log
132+
artifacthub_digest=$(grep "Digest:" oras-push-output.log | awk '{print $2}')
133+
# sign artifacthub-repo.yml
134+
cosign sign "ghcr.io/${GITHUB_REPOSITORY@L}/${chart_name}:artifacthub.io@${artifacthub_digest}"
135+
done
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@
2121
.idea/
2222
*.tmproj
2323
.vscode/
24+
# go template
25+
*.gotmpl
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
apiVersion: v2
22
kubeVersion: ">=1.23.0-0"
3-
name: Jellyseerr
3+
name: jellyseerr-chart
44
description: Jellyseerr helm chart for Kubernetes
55
type: application
6-
version: 1.1.0
7-
appVersion: "2.1.0"
6+
version: 1.3.0
7+
appVersion: "2.2.3"
88
maintainers:
99
- name: Jellyseerr
1010
url: https://github.com/Fallenbagel/jellyseerr
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Jellyseerr
1+
# jellyseerr-chart
22

3-
![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.1.0](https://img.shields.io/badge/AppVersion-2.1.0-informational?style=flat-square)
3+
![Version: 1.3.0](https://img.shields.io/badge/Version-1.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.2.3](https://img.shields.io/badge/AppVersion-2.2.3-informational?style=flat-square)
44

55
Jellyseerr helm chart for Kubernetes
66

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
repositoryID: c6b3f2dc-444c-4e37-b397-6a5ff563ee8b
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)