Skip to content

bugfix readme-workflow #22

bugfix readme-workflow

bugfix readme-workflow #22

Workflow file for this run

name: Release READMEs
on:
workflow_dispatch:
push:
branches:
- master
tags:
- "v**"
paths:
- 'README.md'
- 'charts/**/README.md.gotmpl'
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true
env:
CHARTS_DIR: ./charts
TEMP_DIR: /tmp/readmes
HELM_DOCS_VERSION: 1.11.0
PUSH_TOKEN: ${{ secrets.PROTECTED_PUSH_TOKEN }}
jobs:
release-readme:
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run helm-docs
run: |
curl --silent --show-error --fail --location --output /tmp/helm-docs.tar.gz \
https://github.com/norwoodj/helm-docs/releases/download/v${HELM_DOCS_VERSION}/helm-docs_${HELM_DOCS_VERSION}_Linux_x86_64.tar.gz
tar -xf /tmp/helm-docs.tar.gz helm-docs
./helm-docs
rm ./helm-docs
- name: Prepare READMEs
run: |
mkdir -p $TEMP_DIR
cp -f README.md $TEMP_DIR/README.md
while IFS= read -r -d $'\0' readme; do
CHART_NAME=$(basename $(dirname $readme))
echo "Moving $readme for $CHART_NAME to $TEMP_DIR/$CHART_NAME..."
mkdir -p $TEMP_DIR/charts/$CHART_NAME
mv $readme $TEMP_DIR/charts/$CHART_NAME/
done < <(find $CHARTS_DIR -type f -name README.md -print0)
- name: Ensure PUSH_TOKEN is set
if: env.PUSH_TOKEN == ''
run: echo "PUSH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Checkout Pages
uses: actions/checkout@v3
with:
ref: gh-pages
token: ${{ env.PUSH_TOKEN }}
- name: Sync README.md to pages
run: |
cp -rf $TEMP_DIR/* .
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git add .
git commit --signoff -am "Sync READMEs for ${{github.ref_name}}"
git push