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.
This commit is contained in:
43
.gitea/workflows/build-chart-paperless-ngx.yml
Normal file
43
.gitea/workflows/build-chart-paperless-ngx.yml
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user