Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Release Charts

on:
push:
branches:
- main
paths:
- 'charts/*/Chart.yaml'

jobs:
release:
name: Release Helm Chart
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Install Helm
uses: azure/setup-helm@v3

- name: Update dependencies
run: helm dependency update charts/sourcebot/

- name: Set Chart Version
id: chart-version
run: |
# Extract chart version from the Chart.yaml
CHART_DIR=$(find ./charts -name "Chart.yaml" -not -path "*/\.git/*" | head -1 | xargs dirname)
CHART_NAME=$(yq e '.name' "$CHART_DIR/Chart.yaml")
CHART_VERSION=$(yq e '.version' "$CHART_DIR/Chart.yaml")
REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
echo "chart_dir=$CHART_DIR" >> $GITHUB_OUTPUT
echo "chart_name=$CHART_NAME" >> $GITHUB_OUTPUT
echo "chart_version=$CHART_VERSION" >> $GITHUB_OUTPUT
echo "repo_lower=$REPO_LOWER" >> $GITHUB_OUTPUT
echo "Chart: $CHART_NAME:$CHART_VERSION in $CHART_DIR"

- 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 Chart
run: |
helm package ${{ steps.chart-version.outputs.chart_dir }} --version ${{ steps.chart-version.outputs.chart_version }}

- name: Push to GitHub Container Registry
run: |
helm push ${{ steps.chart-version.outputs.chart_name }}-${{ steps.chart-version.outputs.chart_version }}.tgz oci://ghcr.io/${{ steps.chart-version.outputs.repo_lower }}/charts

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_GENERATE_RELEASE_NOTES: "true"

40 changes: 40 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Unit Tests
on:
pull_request:
push:
branches:
- main

jobs:
unit-tests:
name: Run Helm Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Install helm-unittest plugin
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest.git --version v1.0.0

- name: Update dependencies
run: helm dependency update charts/sourcebot/

- name: Run unit tests
run: |
helm unittest charts/sourcebot/ --color --output-type JUnit --output-file test-results.xml

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: test-results.xml
check_name: "Helm Unit Test Results"
comment_title: "Helm Unit Test Results"
46 changes: 46 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Validate Helm Chart
on:
pull_request:
paths:
- 'charts/**'
push:
branches:
- main

jobs:
validate:
name: Validate Helm Chart
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Install helm-docs
run: |
cd /tmp
curl -L https://github.com/norwoodj/helm-docs/releases/download/v1.14.2/helm-docs_1.14.2_Linux_x86_64.tar.gz | tar xz
sudo mv helm-docs /usr/local/bin/

- name: Update dependencies
run: helm dependency update charts/sourcebot/

- name: Run helm lint
run: helm lint charts/sourcebot/ -f charts/sourcebot/values.lint.yaml

- name: Validate helm-docs
run: |
helm-docs charts/sourcebot/
if [[ $(git diff --stat) != '' ]]; then
echo 'Chart documentation is out of date. Please run helm-docs and commit the changes.'
echo 'Git diff:'
git diff
exit 1
fi

Loading