chore: Revise the default NATS Server address logic #39
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: chart | |
env: | |
HELM_VERSION: v3.14.0 | |
CHART_TESTING_NAMESPACE: chart-testing | |
on: | |
push: | |
tags: | |
- 'chart-v[0-9].[0-9]+.[0-9]+' | |
pull_request: | |
paths: | |
- 'charts/**' | |
- '.github/workflows/chart.yml' | |
jobs: | |
validate: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch main branch for chart-testing | |
run: | | |
git fetch origin main:main | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
with: | |
version: ${{ env.HELM_VERSION }} | |
# Used by helm chart-testing below | |
- name: Set up Python | |
uses: actions/setup-python@v5.2.0 | |
with: | |
python-version: '3.12.2' | |
- name: Set up chart-testing | |
uses: helm/chart-testing-action@v2.6.1 | |
with: | |
version: v3.10.1 | |
yamllint_version: 1.35.1 | |
yamale_version: 5.0.0 | |
- name: Run chart-testing (lint) | |
run: | | |
ct lint --config charts/wadm/ct.yaml | |
- name: Create kind cluster | |
uses: helm/kind-action@v1.10.0 | |
with: | |
version: "v0.22.0" | |
- name: Install nats in the test cluster | |
run: | | |
helm repo add nats https://nats-io.github.io/k8s/helm/charts/ | |
helm repo update | |
helm install nats nats/nats -f charts/wadm/ci/nats.yaml --namespace ${{ env.CHART_TESTING_NAMESPACE }} --create-namespace | |
- name: Run chart-testing install / same namespace | |
run: | | |
ct install --config charts/wadm/ct.yaml --namespace ${{ env.CHART_TESTING_NAMESPACE }} | |
- name: Run chart-testing install / across namespaces | |
run: | | |
ct install --config charts/wadm/ct.yaml --helm-extra-set-args "--set=wadm.config.nats.server=nats://nats-headless.${{ env.CHART_TESTING_NAMESPACE }}.svc.cluster.local" | |
publish: | |
if: ${{ startsWith(github.ref, 'refs/tags/chart-v') }} | |
runs-on: ubuntu-22.04 | |
needs: validate | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
with: | |
version: ${{ env.HELM_VERSION }} | |
- name: Package | |
run: | | |
helm package charts/wadm -d .helm-charts | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Lowercase the organization name for ghcr.io | |
run: | | |
echo "GHCR_REPO_NAMESPACE=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV} | |
- name: Publish | |
run: | | |
for chart in .helm-charts/*; do | |
if [ -z "${chart:-}" ]; then | |
break | |
fi | |
helm push "${chart}" "oci://ghcr.io/${{ env.GHCR_REPO_NAMESPACE }}/charts" | |
done |