Skip to content

Commit

Permalink
feat(ci): Add Helm repo workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianoKF committed Sep 26, 2024
1 parent aec0761 commit 6c8862b
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/backend-helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: "Backend: Helm Chart"

on:
push:
branches:
- main
pull_request:
paths:
- backend/deploy/**
- .github/**
branches:
- main

jobs:
# Lint and package the Helm chart, and upload the package as an artifact.
package:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.16.1

- uses: actions/setup-python@v4
with:
python-version: "3.12"
check-latest: true

- name: Install chart-testing CLI
uses: helm/chart-testing-action@v2

- name: Lint Helm chart
run: ct lint --target-branch main --charts backend/deploy/jobq-server

- name: Package Helm chart
run: helm package backend/deploy/jobq-server

- name: Upload Helm chart artifact
uses: actions/upload-artifact@v4
with:
name: helm-chart
path: jobq-server-*.tgz

# Update the Helm chart repository index under `/index.yaml` on the pages branch, adding the latest chart artifact.
publish:
runs-on: ubuntu-latest
needs: package
if: ${{ github.ref == 'refs/heads/main' }}
concurrency: release-helm
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: gh-pages
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Download Helm chart artifact
uses: actions/download-artifact@v4
with:
name: helm-chart
path: charts/

- name: Set up Helm
uses: azure/setup-helm@v4

- name: Publish Helm chart
run: >
helm repo index .
--merge ./index.yaml
--url https://raw.githubusercontent.com/${{ github.repository }}/gh-pages/charts/
- name: Commit and push changes
run: |
git add index.yaml charts/
git commit -m "Update Helm chart repository" && git push || true

0 comments on commit 6c8862b

Please sign in to comment.