2024-07-04 20:37:30 +00:00
|
|
|
# Publish chart to the GitHub Container Registry (GHCR) on push to master
|
|
|
|
# Run the following tests on PRs:
|
|
|
|
# - Check if chart's documentation is up to date
|
|
|
|
# - Check chart linting
|
|
|
|
# - Check chart installation in a Kind cluster
|
|
|
|
# - Check chart packaging
|
|
|
|
|
|
|
|
name: Chart
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches: [master]
|
2024-09-22 11:25:08 +00:00
|
|
|
paths: ['deploy/helm/**']
|
2024-07-04 20:37:30 +00:00
|
|
|
push:
|
|
|
|
branches: [master]
|
2024-09-22 11:25:08 +00:00
|
|
|
paths: ['deploy/helm/**']
|
2024-07-04 20:37:30 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint-test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2024-09-22 11:25:08 +00:00
|
|
|
- name: Check docs
|
|
|
|
run: |
|
|
|
|
make helm-docs
|
|
|
|
if ! git diff --exit-code; then
|
|
|
|
echo "error::Documentation is not up to date. Please run helm-docs and commit changes."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-07-04 20:37:30 +00:00
|
|
|
# ct lint requires Python 3.x to run following packages:
|
|
|
|
# - yamale (https://github.com/23andMe/Yamale)
|
|
|
|
# - yamllint (https://github.com/adrienverge/yamllint)
|
2024-07-04 21:09:44 +00:00
|
|
|
- uses: actions/setup-python@v5
|
2024-07-04 20:37:30 +00:00
|
|
|
with:
|
|
|
|
python-version: '3.x'
|
|
|
|
|
|
|
|
- uses: helm/chart-testing-action@v2
|
|
|
|
|
|
|
|
- name: Run chart-testing (lint)
|
|
|
|
run: ct lint --config ct.yaml
|
|
|
|
|
2024-09-22 11:25:08 +00:00
|
|
|
- uses: nolar/setup-k3d-k3s@v1
|
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
2024-07-04 20:37:30 +00:00
|
|
|
|
|
|
|
- name: Run chart-testing (install)
|
|
|
|
run: ct install --config ct.yaml
|
|
|
|
|
2024-09-23 19:54:22 +00:00
|
|
|
- name: Check chart packaging
|
|
|
|
run: helm package deploy/helm
|
2024-07-04 20:37:30 +00:00
|
|
|
|
|
|
|
publish:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: ${{ github.event_name == 'push' }}
|
|
|
|
permissions:
|
|
|
|
packages: write
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
2024-07-04 21:09:44 +00:00
|
|
|
- uses: docker/login-action@v3
|
2024-07-04 20:37:30 +00:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2024-09-23 19:54:22 +00:00
|
|
|
- name: Package helm chart
|
|
|
|
run: helm package deploy/helm
|
2024-07-04 20:37:30 +00:00
|
|
|
|
|
|
|
- name: Push chart to GHCR
|
2024-09-23 19:54:22 +00:00
|
|
|
run: helm push wg-portal-*.tgz oci://ghcr.io/${{ github.repository_owner }}/charts
|