From 3cc34b0db6b868a6133408a69a60b7eab69d9ea3 Mon Sep 17 00:00:00 2001 From: Ludovic Ortega Date: Sun, 12 Jan 2025 15:44:38 +0100 Subject: [PATCH] feat: Add release charts workflow (#1140) * feat: Add release charts workflow Signed-off-by: Ludovic Ortega * fix: helm workflow Signed-off-by: Ludovic Ortega * fix: artifacthub file location Signed-off-by: Ludovic Ortega * feat: bump chart to 1.2.0 Signed-off-by: Ludovic Ortega * fix: documentation build Signed-off-by: Ludovic Ortega * fix: install oras in first job Signed-off-by: Ludovic Ortega * fix: release workflow Signed-off-by: Ludovic Ortega * fix: release workflow add package read permission Signed-off-by: Ludovic Ortega * fix: login to ghcr.io at the beginning of job Signed-off-by: Ludovic Ortega * fix: avoid exiting on oras discover Signed-off-by: Ludovic Ortega * fix: documentation typo * feat: prepare for release Signed-off-by: Ludovic Ortega * fix: remove myself from codeowners Signed-off-by: Ludovic Ortega --------- Signed-off-by: Ludovic Ortega --- .github/workflows/helm.yml | 135 ++++++++++++++++++ .../.helmignore | 2 + .../Chart.yaml | 6 +- .../README.md | 4 +- .../README.md.gotmpl | 0 charts/jellyseerr-chart/artifacthub-repo.yml | 1 + .../templates/NOTES.txt | 0 .../templates/_helpers.tpl | 0 .../templates/deployment.yaml | 0 .../templates/hpa.yaml | 0 .../templates/ingress.yaml | 0 .../templates/persistentvolumeclaim.yaml | 0 .../templates/service.yaml | 0 .../templates/serviceaccount.yaml | 0 .../templates/tests/test-connection.yaml | 0 .../values.yaml | 0 docs/getting-started/kubernetes.mdx | 21 +++ 17 files changed, 164 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/helm.yml rename charts/{jellyseerr => jellyseerr-chart}/.helmignore (93%) rename charts/{jellyseerr => jellyseerr-chart}/Chart.yaml (84%) rename charts/{jellyseerr => jellyseerr-chart}/README.md (94%) rename charts/{jellyseerr => jellyseerr-chart}/README.md.gotmpl (100%) create mode 100644 charts/jellyseerr-chart/artifacthub-repo.yml rename charts/{jellyseerr => jellyseerr-chart}/templates/NOTES.txt (100%) rename charts/{jellyseerr => jellyseerr-chart}/templates/_helpers.tpl (100%) rename charts/{jellyseerr => jellyseerr-chart}/templates/deployment.yaml (100%) rename charts/{jellyseerr => jellyseerr-chart}/templates/hpa.yaml (100%) rename charts/{jellyseerr => jellyseerr-chart}/templates/ingress.yaml (100%) rename charts/{jellyseerr => jellyseerr-chart}/templates/persistentvolumeclaim.yaml (100%) rename charts/{jellyseerr => jellyseerr-chart}/templates/service.yaml (100%) rename charts/{jellyseerr => jellyseerr-chart}/templates/serviceaccount.yaml (100%) rename charts/{jellyseerr => jellyseerr-chart}/templates/tests/test-connection.yaml (100%) rename charts/{jellyseerr => jellyseerr-chart}/values.yaml (100%) create mode 100644 docs/getting-started/kubernetes.mdx diff --git a/.github/workflows/helm.yml b/.github/workflows/helm.yml new file mode 100644 index 000000000..131e6102f --- /dev/null +++ b/.github/workflows/helm.yml @@ -0,0 +1,135 @@ +name: Release Charts + +on: + push: + branches: + - develop + +jobs: + package-helm-chart: + name: Package helm chart + runs-on: ubuntu-latest + permissions: + contents: read + packages: read + outputs: + has_artifacts: ${{ steps.check-artifacts.outputs.has_artifacts }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install helm + uses: azure/setup-helm@v4 + + - name: Install Oras + uses: oras-project/setup-oras@v1 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Package helm charts + run: | + mkdir -p ./.cr-release-packages + for chart_path in ./charts/*; do + if [ -d "$chart_path" ] && [ -f "$chart_path/Chart.yaml" ]; then + chart_name=$(grep '^name:' "$chart_path/Chart.yaml" | awk '{print $2}') + # get current version + current_version=$(grep '^version:' "$chart_path/Chart.yaml" | awk '{print $2}') + # try to get current release version + set +e + oras discover ghcr.io/${GITHUB_REPOSITORY@L}/${chart_name}:${current_version} + oras_exit_code=$? + set -e + + if [ $oras_exit_code -ne 0 ]; then + helm dependency build "$chart_path" + helm package "$chart_path" --destination ./.cr-release-packages + else + echo "No version change for $chart_name. Skipping." + fi + else + echo "Skipping $chart_name: Not a valid Helm chart" + fi + done + + - name: Check if artifacts exist + id: check-artifacts + run: | + if ls .cr-release-packages/* >/dev/null 2>&1; then + echo "has_artifacts=true" >> $GITHUB_OUTPUT + else + echo "has_artifacts=false" >> $GITHUB_OUTPUT + fi + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + if: steps.check-artifacts.outputs.has_artifacts == 'true' + with: + name: artifacts + include-hidden-files: true + path: .cr-release-packages/ + + publish: + name: Publish to ghcr.io + runs-on: ubuntu-latest + permissions: + packages: write # needed for pushing to github registry + id-token: write # needed for signing the images with GitHub OIDC Token + needs: [package-helm-chart] + if: needs.package-helm-chart.outputs.has_artifacts == 'true' + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install helm + uses: azure/setup-helm@v4 + + - name: Install Oras + uses: oras-project/setup-oras@v1 + + - name: Install Cosign + uses: sigstore/cosign-installer@v3 + + - name: Downloads artifacts + uses: actions/download-artifact@v4 + with: + name: artifacts + path: .cr-release-packages/ + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push charts to GHCR + env: + COSIGN_YES: true + run: | + for chart_path in `find .cr-release-packages -name '*.tgz' -print`; do + # push chart to OCI + chart_release_file=$(basename "$chart_path") + chart_name=${chart_release_file%-*} + helm push ${chart_path} oci://ghcr.io/${GITHUB_REPOSITORY@L} |& tee helm-push-output.log + chart_digest=$(awk -F "[, ]+" '/Digest/{print $NF}' < helm-push-output.log) + # sign chart + cosign sign "ghcr.io/${GITHUB_REPOSITORY@L}/${chart_name}@${chart_digest}" + # push artifacthub-repo.yml to OCI + oras push \ + ghcr.io/${GITHUB_REPOSITORY@L}/${chart_name}:artifacthub.io \ + --config /dev/null:application/vnd.cncf.artifacthub.config.v1+yaml \ + charts/$chart_name/artifacthub-repo.yml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml \ + |& tee oras-push-output.log + artifacthub_digest=$(grep "Digest:" oras-push-output.log | awk '{print $2}') + # sign artifacthub-repo.yml + cosign sign "ghcr.io/${GITHUB_REPOSITORY@L}/${chart_name}:artifacthub.io@${artifacthub_digest}" + done diff --git a/charts/jellyseerr/.helmignore b/charts/jellyseerr-chart/.helmignore similarity index 93% rename from charts/jellyseerr/.helmignore rename to charts/jellyseerr-chart/.helmignore index 0e8a0eb36..e8232ed52 100644 --- a/charts/jellyseerr/.helmignore +++ b/charts/jellyseerr-chart/.helmignore @@ -21,3 +21,5 @@ .idea/ *.tmproj .vscode/ +# go template +*.gotmpl diff --git a/charts/jellyseerr/Chart.yaml b/charts/jellyseerr-chart/Chart.yaml similarity index 84% rename from charts/jellyseerr/Chart.yaml rename to charts/jellyseerr-chart/Chart.yaml index c06600e56..3e488f0fb 100644 --- a/charts/jellyseerr/Chart.yaml +++ b/charts/jellyseerr-chart/Chart.yaml @@ -1,10 +1,10 @@ apiVersion: v2 kubeVersion: ">=1.23.0-0" -name: Jellyseerr +name: jellyseerr-chart description: Jellyseerr helm chart for Kubernetes type: application -version: 1.1.0 -appVersion: "2.1.0" +version: 1.3.0 +appVersion: "2.2.3" maintainers: - name: Jellyseerr url: https://github.com/Fallenbagel/jellyseerr diff --git a/charts/jellyseerr/README.md b/charts/jellyseerr-chart/README.md similarity index 94% rename from charts/jellyseerr/README.md rename to charts/jellyseerr-chart/README.md index 45d77c90f..f587aacbc 100644 --- a/charts/jellyseerr/README.md +++ b/charts/jellyseerr-chart/README.md @@ -1,6 +1,6 @@ -# Jellyseerr +# jellyseerr-chart -![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) +![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) Jellyseerr helm chart for Kubernetes diff --git a/charts/jellyseerr/README.md.gotmpl b/charts/jellyseerr-chart/README.md.gotmpl similarity index 100% rename from charts/jellyseerr/README.md.gotmpl rename to charts/jellyseerr-chart/README.md.gotmpl diff --git a/charts/jellyseerr-chart/artifacthub-repo.yml b/charts/jellyseerr-chart/artifacthub-repo.yml new file mode 100644 index 000000000..849fcf8d9 --- /dev/null +++ b/charts/jellyseerr-chart/artifacthub-repo.yml @@ -0,0 +1 @@ +repositoryID: c6b3f2dc-444c-4e37-b397-6a5ff563ee8b diff --git a/charts/jellyseerr/templates/NOTES.txt b/charts/jellyseerr-chart/templates/NOTES.txt similarity index 100% rename from charts/jellyseerr/templates/NOTES.txt rename to charts/jellyseerr-chart/templates/NOTES.txt diff --git a/charts/jellyseerr/templates/_helpers.tpl b/charts/jellyseerr-chart/templates/_helpers.tpl similarity index 100% rename from charts/jellyseerr/templates/_helpers.tpl rename to charts/jellyseerr-chart/templates/_helpers.tpl diff --git a/charts/jellyseerr/templates/deployment.yaml b/charts/jellyseerr-chart/templates/deployment.yaml similarity index 100% rename from charts/jellyseerr/templates/deployment.yaml rename to charts/jellyseerr-chart/templates/deployment.yaml diff --git a/charts/jellyseerr/templates/hpa.yaml b/charts/jellyseerr-chart/templates/hpa.yaml similarity index 100% rename from charts/jellyseerr/templates/hpa.yaml rename to charts/jellyseerr-chart/templates/hpa.yaml diff --git a/charts/jellyseerr/templates/ingress.yaml b/charts/jellyseerr-chart/templates/ingress.yaml similarity index 100% rename from charts/jellyseerr/templates/ingress.yaml rename to charts/jellyseerr-chart/templates/ingress.yaml diff --git a/charts/jellyseerr/templates/persistentvolumeclaim.yaml b/charts/jellyseerr-chart/templates/persistentvolumeclaim.yaml similarity index 100% rename from charts/jellyseerr/templates/persistentvolumeclaim.yaml rename to charts/jellyseerr-chart/templates/persistentvolumeclaim.yaml diff --git a/charts/jellyseerr/templates/service.yaml b/charts/jellyseerr-chart/templates/service.yaml similarity index 100% rename from charts/jellyseerr/templates/service.yaml rename to charts/jellyseerr-chart/templates/service.yaml diff --git a/charts/jellyseerr/templates/serviceaccount.yaml b/charts/jellyseerr-chart/templates/serviceaccount.yaml similarity index 100% rename from charts/jellyseerr/templates/serviceaccount.yaml rename to charts/jellyseerr-chart/templates/serviceaccount.yaml diff --git a/charts/jellyseerr/templates/tests/test-connection.yaml b/charts/jellyseerr-chart/templates/tests/test-connection.yaml similarity index 100% rename from charts/jellyseerr/templates/tests/test-connection.yaml rename to charts/jellyseerr-chart/templates/tests/test-connection.yaml diff --git a/charts/jellyseerr/values.yaml b/charts/jellyseerr-chart/values.yaml similarity index 100% rename from charts/jellyseerr/values.yaml rename to charts/jellyseerr-chart/values.yaml diff --git a/docs/getting-started/kubernetes.mdx b/docs/getting-started/kubernetes.mdx new file mode 100644 index 000000000..c3e36ef13 --- /dev/null +++ b/docs/getting-started/kubernetes.mdx @@ -0,0 +1,21 @@ +--- +title: Kubernetes +description: Install Jellyseerr in Kubernetes +sidebar_position: 5 +--- +# Kubernetes +:::info +This method is not recommended for most users. It is intended for advanced users who are using Kubernetes. +::: + +## Installation +```console +helm install jellyseerr oci://ghcr.io/fallenbagel/jellyseerr/jellyseerr-chart +``` +Helm values can be found in the Jellyseerr repository under [charts/jellyseerr-chart/README.md](https://github.com/Fallenbagel/jellyseerr/tree/develop/charts/jellyseerr-chart). + +Verify the signature with [cosign](https://docs.sigstore.dev/cosign/system_config/installation/) (replace [tag], with the TAG you want to verify) : +```console +cosign verify ghcr.io/fallenbagel/jellyseerr/jellyseerr-chart:[tag] --certificate-identity=https://github.com/Fallenbagel/jellyseerr/.github/workflows/helm.yml@refs/heads/main --certificate-oidc-issuer=https://token.ac +tions.githubusercontent.com +``` \ No newline at end of file