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
outputs:
commitHash:
description: "The commit hash from the README.md upate"
value: ${{ jobs.generate-readme.outputs.commitHash }}
description: "The most recent commit hash at the end of this workflow"
value: ${{ jobs.generate-changelog.outputs.commitHash }}
jobs:
validate-changelog:
@ -35,29 +35,25 @@ jobs:
echo ""
done
generate-readme:
name: Generate chart README files
generate-changelog:
name: Generate changelog annotations
runs-on: ubuntu-latest
needs:
- validate-changelog
outputs:
commitHash: ${{ steps.store-commit-hash.outputs.commit_hash }}
commitHash: ${{ steps.save-commit-hash.outputs.commit_hash }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Kubernetes tools
if: inputs.isRenovatePR == 'true'
uses: yokawasa/action-setup-kube-tools@v0.8.0
with:
setup-tools: |
yq
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
if: inputs.isRenovatePR == 'true'
run: |
@ -70,32 +66,18 @@ jobs:
echo ""
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
id: create-commit
if: inputs.isRenovatePR == 'true'
uses: stefanzweifel/git-auto-commit-action@v4
with:
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_email: ${{ github.actor }}@users.noreply.github.com
- name: Store commit hash
id: store-commit-hash
- name: Save commit hash
id: save-commit-hash
run: |
if [ "${{ steps.create-commit.outputs.changes_detected || 'unknown' }}" == "true" ]; then
echo '::set-output name=commit_hash::${{ steps.create-commit.outputs.commit_hash }}'

View File

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