From 3868575669ca2fc18fe063b4e1feacbe903cbd81 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 31 Oct 2025 12:12:48 +0100 Subject: [PATCH] Add GitHub Actions workflow for building Helm chart This commit introduces a new GitHub Actions workflow defined in `.gitea/workflows/build-chart-paperless-ngx.yml` to automate the building and packaging of the Helm chart for the Paperless-ng project. The workflow triggers on pushes to the `main` branch when changes are made to the `charts/paperless-ngx/Chart.yaml` file. The key steps in this workflow include checking out the repository, extracting the Helm chart's application name and version from the `Chart.yaml`, setting up Helm, updating dependencies, linting the chart, and finally packaging it. The resulting Helm package is then uploaded to a specified Helm registry using the credentials stored in the repository's secrets. This automation is important for ensuring that the Helm chart can be consistently and reliably built with each update, enhancing the deployment process. --- .../workflows/build-chart-paperless-ngx.yml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .gitea/workflows/build-chart-paperless-ngx.yml diff --git a/.gitea/workflows/build-chart-paperless-ngx.yml b/.gitea/workflows/build-chart-paperless-ngx.yml new file mode 100644 index 0000000..74870de --- /dev/null +++ b/.gitea/workflows/build-chart-paperless-ngx.yml @@ -0,0 +1,43 @@ +name: "Build Helm Chart" +on: + push: + branches: + - main + paths: + - "charts/paperless-ngx/Chart.yaml" + +jobs: + helm-package: + runs-on: ubuntu-latest + env: + APP: charts/pperless-ngx + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set Helm Chart App Name and Version + id: get_version + run: | + APP_NAME=$(grep -oP '(?<=^name: ).*' ${{ env.APP }}/Chart.yaml) + echo "Helm Chart App Name: $APP_NAME" + echo "::set-output name=app::$APP_NAME" + + CHART_VERSION=$(grep -oP '(?<=^version: ).*' ${{ env.APP }}/Chart.yaml) + echo "Helm Chart version: $CHART_VERSION" + echo "::set-output name=tag::$CHART_VERSION" + + - name: Setup Helm + run: | + #curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash + curl -kSso /usr/local/bin/helm https://debmirror.cooltux.net/helm-v3.18.4 && chmod +x /usr/local/bin/helm + helm version + + - name: Package Helm Chart + run: | + helm dependency update ${{ env.APP }} + helm lint ${{ env.APP }} + helm package ${{ env.APP }} + + - name: Upload Helm Package to repo + run: | + curl --user ${{ secrets.USER }}:${{ secrets.TOKEN }} -X POST --upload-file ./${{ steps.get_version.outputs.app }}-${{ steps.get_version.outputs.tag }}.tgz ${{ vars.HELMREGISTRY }}/api/packages/${{ vars.OWNER }}/helm/api/charts