88 lines
2.4 KiB
YAML
88 lines
2.4 KiB
YAML
name: Helm
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- legacy
|
|
|
|
jobs:
|
|
|
|
changes:
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
(github.repository == 'kubernetes/ingress-nginx')
|
|
outputs:
|
|
docs: ${{ steps.filter.outputs.docs }}
|
|
charts: ${{ steps.filter.outputs.charts }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- uses: dorny/paths-filter@v2
|
|
id: filter
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
filters: |
|
|
charts:
|
|
- 'charts/ingress-nginx/Chart.yaml'
|
|
- 'charts/ingress-nginx/**/*'
|
|
|
|
chart:
|
|
name: Release Chart
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: write # needed to write releases
|
|
|
|
needs:
|
|
- changes
|
|
if: |
|
|
(github.repository == 'kubernetes/ingress-nginx') &&
|
|
(needs.changes.outputs.charts == 'true')
|
|
|
|
steps:
|
|
|
|
- name: Checkout master
|
|
uses: actions/checkout@v2
|
|
with:
|
|
# Fetch entire history. Required for chart-releaser; see https://github.com/helm/chart-releaser-action/issues/13#issuecomment-602063896
|
|
fetch-depth: 0
|
|
|
|
- name: Setup
|
|
shell: bash
|
|
run: |
|
|
git config --global user.name "$GITHUB_ACTOR"
|
|
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
|
|
|
- name: Set up Go 1.17
|
|
id: go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.17
|
|
|
|
- name: Run helm-docs
|
|
env:
|
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
run: |
|
|
cd ${GITHUB_WORKSPACE}
|
|
GOBIN=$PWD GO111MODULE=on go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.6.0
|
|
./helm-docs --chart-search-root=${GITHUB_WORKSPACE}/charts
|
|
DIFF=$(git diff ${GITHUB_WORKSPACE}/charts/ingress-nginx/README.md)
|
|
if [ ! -z "$DIFF" ]; then
|
|
git add ${GITHUB_WORKSPACE}/charts/ingress-nginx/README.md
|
|
git commit -m "Update helm README"
|
|
git push --force https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git main
|
|
fi
|
|
rm ./helm-docs
|
|
|
|
|
|
- name: Run chart-releaser
|
|
uses: helm/chart-releaser-action@v1.2.1
|
|
env:
|
|
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
CR_RELEASE_NAME_TEMPLATE: "helm-chart-{{ .Version }}"
|
|
with:
|
|
charts_dir: charts
|