ci: Clean up validation flow

Signed-off-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>
This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2022-02-04 21:04:23 +01:00
parent 2e63e3740b
commit e8e2d25873
No known key found for this signature in database
GPG Key ID: BC5E2BD907F9A8EC
2 changed files with 15 additions and 33 deletions

View File

@ -11,8 +11,8 @@ on:
type: string type: string
outputs: outputs:
commitHash: commitHash:
description: "The commit hash from the README.md upate" description: "The most recent commit hash at the end of this workflow"
value: ${{ jobs.generate-readme.outputs.commitHash }} value: ${{ jobs.generate-changelog.outputs.commitHash }}
jobs: jobs:
validate-changelog: validate-changelog:
@ -35,29 +35,25 @@ jobs:
echo "" echo ""
done done
generate-readme: generate-changelog:
name: Generate chart README files name: Generate changelog annotations
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
- validate-changelog - validate-changelog
outputs: outputs:
commitHash: ${{ steps.store-commit-hash.outputs.commit_hash }} commitHash: ${{ steps.save-commit-hash.outputs.commit_hash }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install Kubernetes tools - name: Install Kubernetes tools
if: inputs.isRenovatePR == 'true'
uses: yokawasa/action-setup-kube-tools@v0.8.0 uses: yokawasa/action-setup-kube-tools@v0.8.0
with: with:
setup-tools: | setup-tools: |
yq yq
yq: "4.16.2" yq: "4.16.2"
- name: Install helm-docs
run: |
wget -O /tmp/helm-docs.deb https://github.com/k8s-at-home/helm-docs/releases/download/v0.1.1/helm-docs_0.1.1_Linux_x86_64.deb
sudo dpkg -i /tmp/helm-docs.deb
- name: Annotate Charts.yaml for Renovate PR's - name: Annotate Charts.yaml for Renovate PR's
if: inputs.isRenovatePR == 'true' if: inputs.isRenovatePR == 'true'
run: | run: |
@ -70,32 +66,18 @@ jobs:
echo "" echo ""
done done
- name: Generate README for changed charts in Renovate PR's
if: inputs.isRenovatePR == 'true'
run: |
CHARTS=(${{ inputs.modifiedCharts }})
for i in "${CHARTS[@]}"
do
printf "Rendering README for chart %s\n" "${i}"
IFS='/' read -r -a chart_parts <<< "$i"
if [ -f "charts/${chart_parts[0]}"/"${chart_parts[1]}/Chart.yaml" ]; then
./.github/scripts/gen-helm-docs.sh "${chart_parts[0]}" "${chart_parts[1]}"
fi
echo ""
done
- name: Create commit - name: Create commit
id: create-commit id: create-commit
if: inputs.isRenovatePR == 'true' if: inputs.isRenovatePR == 'true'
uses: stefanzweifel/git-auto-commit-action@v4 uses: stefanzweifel/git-auto-commit-action@v4
with: with:
file_pattern: charts/**/ file_pattern: charts/**/
commit_message: Auto-update chart metadata and README commit_message: "chore: Auto-update chart metadata [skip ci]"
commit_user_name: ${{ github.actor }} commit_user_name: ${{ github.actor }}
commit_user_email: ${{ github.actor }}@users.noreply.github.com commit_user_email: ${{ github.actor }}@users.noreply.github.com
- name: Store commit hash - name: Save commit hash
id: store-commit-hash id: save-commit-hash
run: | run: |
if [ "${{ steps.create-commit.outputs.changes_detected || 'unknown' }}" == "true" ]; then if [ "${{ steps.create-commit.outputs.changes_detected || 'unknown' }}" == "true" ]; then
echo '::set-output name=commit_hash::${{ steps.create-commit.outputs.commit_hash }}' echo '::set-output name=commit_hash::${{ steps.create-commit.outputs.commit_hash }}'

View File

@ -20,8 +20,8 @@ jobs:
with: with:
modifiedFiles: ${{ needs.pr-metadata.outputs.addedOrModifiedFiles }} modifiedFiles: ${{ needs.pr-metadata.outputs.addedOrModifiedFiles }}
charts-readme: charts-changelog:
uses: k8s-at-home/charts/.github/workflows/charts-readme.yaml@master uses: k8s-at-home/charts/.github/workflows/charts-changelog.yaml@master
needs: needs:
- pr-metadata - pr-metadata
- pre-commit-check - pre-commit-check
@ -33,15 +33,15 @@ jobs:
uses: k8s-at-home/charts/.github/workflows/charts-lint.yaml@master uses: k8s-at-home/charts/.github/workflows/charts-lint.yaml@master
needs: needs:
- pr-metadata - pr-metadata
- charts-readme - charts-changelog
with: with:
checkoutCommit: ${{ needs.charts-readme.outputs.commitHash }} checkoutCommit: ${{ needs.charts-changelog.outputs.commitHash }}
charts-test: charts-test:
uses: k8s-at-home/charts/.github/workflows/charts-test.yaml@master uses: k8s-at-home/charts/.github/workflows/charts-test.yaml@master
needs: needs:
- pr-metadata - pr-metadata
- charts-readme - charts-changelog
- charts-lint - charts-lint
with: with:
checkoutCommit: ${{ needs.charts-readme.outputs.commitHash }} checkoutCommit: ${{ needs.charts-changelog.outputs.commitHash }}