mirror of
https://github.com/enix/x509-certificate-exporter.git
synced 2026-08-19 03:56:21 +00:00
93 lines
3.2 KiB
YAML
93 lines
3.2 KiB
YAML
name: Chart docs
|
|
|
|
# Keep chart/README.md and chart/values.schema.json in lockstep with
|
|
# chart/values.yaml. helm-docs renders chart/README.md.gotmpl + values.yaml
|
|
# into chart/README.md; helm-schema reads values.yaml + the inline
|
|
# `# @schema` annotations and emits chart/values.schema.json. `task
|
|
# doc:helm` does both locally; this workflow guarantees CI does too.
|
|
#
|
|
# - On a PR: regenerate both, fail if either drifts from what the author
|
|
# committed. Tells contributors to run `task doc:helm` locally.
|
|
# - On main: regenerate both and commit the diff back if anything changed.
|
|
# - Reusable: another workflow (e.g. release) can `uses:` this file to
|
|
# force a verify regardless of which paths changed — workflow_call does
|
|
# not honor `paths:` filters, which is the intended behavior at release
|
|
# time.
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- chart/README.md.gotmpl
|
|
- chart/values.yaml
|
|
pull_request:
|
|
paths:
|
|
- chart/README.md.gotmpl
|
|
- chart/values.yaml
|
|
workflow_call:
|
|
|
|
# Read-only by default. The `regenerate` job overrides with
|
|
# contents:write because it commits the regenerated artifacts back to main.
|
|
permissions:
|
|
contents: read
|
|
|
|
# Silence Dagger's Cloud upload and analytics paths globally.
|
|
env:
|
|
DAGGER_NO_NAG: "1"
|
|
DAGGER_CLOUD_TOKEN: ""
|
|
DO_NOT_TRACK: "1"
|
|
|
|
jobs:
|
|
verify:
|
|
name: Verify
|
|
if: github.event_name != 'push'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
fetch-depth: 1
|
|
- uses: ./.github/actions/dagger
|
|
with:
|
|
args: helm-docs export --path=chart/README.md
|
|
- uses: ./.github/actions/dagger
|
|
with:
|
|
args: chart-schema export --path=chart/values.schema.json
|
|
- name: Fail if chart docs are stale
|
|
run: |
|
|
stale=()
|
|
git diff --quiet -- chart/README.md || stale+=("chart/README.md")
|
|
git diff --quiet -- chart/values.schema.json || stale+=("chart/values.schema.json")
|
|
if [ ${#stale[@]} -gt 0 ]; then
|
|
for f in "${stale[@]}"; do
|
|
echo "::error file=$f::$f is out of date relative to chart/values.yaml. Run 'task doc:helm' locally and commit the result."
|
|
done
|
|
exit 1
|
|
fi
|
|
|
|
regenerate:
|
|
name: Regenerate
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
fetch-depth: 1
|
|
- uses: ./.github/actions/dagger
|
|
with:
|
|
args: helm-docs export --path=chart/README.md
|
|
- uses: ./.github/actions/dagger
|
|
with:
|
|
args: chart-schema export --path=chart/values.schema.json
|
|
- name: Commit regenerated chart docs if changed
|
|
run: |
|
|
if git diff --quiet -- chart/README.md chart/values.schema.json; then
|
|
echo "No changes; nothing to commit."
|
|
exit 0
|
|
fi
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add chart/README.md chart/values.schema.json
|
|
git commit -m "docs(chart): regenerate README and schema from values.yaml"
|
|
git push
|