Skip to content

Release Charts

Release Charts #135

name: "Release Charts"
on:
push:
branches:
- master
paths:
- 'charts/**'
- '!charts/**/README.md'
- '!charts/**/README.md.gotmpl'
jobs:
validate:
name: Validate charts
runs-on: ubuntu-latest
outputs:
matrix: |
{
"chart": ${{ steps.set-matrix.outputs.charts }}
}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v3
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.10.0
- name: Install helm-docs
run: |
wget https://github.com/norwoodj/helm-docs/releases/download/v1.11.0/helm-docs_1.11.0_Linux_x86_64.tar.gz -O /tmp/helm-docs.tar.gz
tar -xvf /tmp/helm-docs.tar.gz -C /tmp
sudo mv /tmp/helm-docs /usr/local/sbin
- name: Validate
uses: pre-commit/[email protected]
- name: Get changed files
id: detect-changes
uses: tj-actions/changed-files@v35
with:
json: true
dir_names: true
dir_names_max_depth: 2
files: |
charts/**
- name: Configure matrix for test
id: set-matrix
run: |
EXCLUDED=$(cat .ct.yaml | yq '.excluded-charts[] |= "charts/" + .' | yq -o json '.excluded-charts // []')
CHARTS="${{ steps.detect-changes.outputs.all_changed_files }}"
OUTPUT_JSON=$(echo "{\"excluded\": ${EXCLUDED}, \"all\": ${CHARTS}}" | jq -c '.all-.excluded')
echo "charts=${OUTPUT_JSON}" >> "$GITHUB_OUTPUT"
test:
name: Test charts
runs-on: ubuntu-latest
needs: validate
strategy:
matrix: ${{ fromJson(needs.validate.outputs.matrix) }}
fail-fast: false
max-parallel: 15
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.10.0
- name: Install chart linting
uses: helm/[email protected]
- name: Create kind cluster
uses: helm/[email protected]
- name: Run ct install
run: ct lint-and-install --config=.ct.yaml --charts ${{ matrix.chart }}
release:
name: Publish charts
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.10.0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_SKIP_EXISTING: true