charts/.github/workflows/charts-release.yaml

153 lines
4.2 KiB
YAML
Raw Normal View History

2021-01-11 01:29:16 +00:00
name: "Charts: Release"
concurrency: helm-release
on:
2021-03-18 12:18:14 +00:00
workflow_dispatch:
push:
branches:
2021-02-17 22:43:56 +00:00
- master
paths:
2021-02-17 22:43:56 +00:00
- 'charts/**'
jobs:
generate-readme:
name: Auto-generate chart README
runs-on: ubuntu-20.04
steps:
- name: Get k8s-at-home token
id: get-app-token
uses: getsentry/action-github-app-token@v1
with:
app_id: ${{ secrets.K8S_AT_HOME_APP_ID }}
private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ steps.get-app-token.outputs.token }}
ref: ${{ github.ref }}
fetch-depth: 0
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
filters: |
addedOrModified:
- added|modified: 'charts/**'
- name: Install Helm
if: steps.filter.outputs.addedOrModified == 'true'
uses: azure/setup-helm@v1
with:
version: v3.5.3
- uses: actions/setup-python@v2
if: steps.filter.outputs.addedOrModified == 'true'
with:
python-version: 3.7
- name: Install helm-docs
if: steps.filter.outputs.addedOrModified == 'true'
run: |
wget -O /tmp/helm-docs.deb https://github.com/norwoodj/helm-docs/releases/download/v1.5.0/helm-docs_1.5.0_linux_amd64.deb
sudo dpkg -i /tmp/helm-docs.deb
- name: Run against changed charts
if: steps.filter.outputs.addedOrModified == 'true'
run: |
CHARTS=()
PATHS=(${{ steps.filter.outputs.addedOrModified_files }})
# Get only the chart paths
for i in "${PATHS[@]}"
do
IFS='/' read -r -a path_parts <<< "$i"
CHARTS+=("${path_parts[1]}/${path_parts[2]}")
done
# Remove duplicates
CHARTS=( `for i in ${CHARTS[@]}; do echo $i; done | sort -u` )
for i in "${CHARTS[@]}"
do
echo "Rendering README for chart ${i}"
IFS='/' read -r -a chart_parts <<< "$i"
./hack/gen-helm-docs.sh "${chart_parts[0]}" "${chart_parts[1]}"
echo ""
done
- name: Create commit
if: steps.filter.outputs.addedOrModified == 'true'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Auto-generate chart README [no ci]
commit_user_name: k8s-at-home[bot]
commit_user_email: <k8s-at-home[bot]@users.noreply.github.com>
commit_author: k8s-at-home[bot] <k8s-at-home[bot]@users.noreply.github.com>
file_pattern: charts/**/
release:
runs-on: ubuntu-20.04
needs:
- generate-readme
steps:
2021-02-17 22:43:56 +00:00
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
2021-02-17 22:43:56 +00:00
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
2021-02-17 22:43:56 +00:00
- name: Install Helm
uses: azure/setup-helm@v1
with:
2021-03-12 13:57:27 +00:00
version: v3.5.3
2021-02-17 22:43:56 +00:00
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.2.1
2021-02-17 22:43:56 +00:00
with:
2021-03-18 12:15:55 +00:00
charts_dir: charts/*
2021-02-17 22:43:56 +00:00
charts_repo_url: https://k8s-at-home.com/charts/
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_SKIP_EXISTING: "true"
generate-summary:
name: Auto-generate charts summary
runs-on: ubuntu-20.04
steps:
- name: Get k8s-at-home token
id: get-app-token
uses: getsentry/action-github-app-token@v1
with:
app_id: ${{ secrets.K8S_AT_HOME_APP_ID }}
private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ steps.get-app-token.outputs.token }}
ref: ${{ github.ref }}
- name: Install yq
uses: chrisdickinson/setup-yq@latest
with:
yq-version: v4.9.3
- name: Run script
run: |
./hack/gen-chart-summary.sh
- name: Update Pull Request
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Auto-generate chart summary [ci skip]
commit_user_name: k8s-at-home[bot]
commit_user_email: <k8s-at-home[bot]@users.noreply.github.com>
commit_author: k8s-at-home[bot] <k8s-at-home[bot]@users.noreply.github.com>
file_pattern: charts/README.md