Automatic update CHANGELOGs and READMEs (#2038) #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Update docs" | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'README.md' | |
- 'charts/**/README.md' | |
- 'charts/**/README.md.gotmpl' | |
- '**/README.md' | |
- '**/README.md.gotmpl' | |
- '.github/workflows/docs.yaml' | |
jobs: | |
publish-readme: | |
permissions: | |
contents: write | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout charts repo | |
uses: actions/checkout@v4 | |
with: | |
path: __vm-helm-charts | |
- name: Checkout docs repo | |
uses: actions/checkout@v4 | |
with: | |
repository: VictoriaMetrics/vmdocs | |
ref: main | |
token: ${{ secrets.VM_BOT_GH_TOKEN }} | |
path: __vm-docs | |
- name: Import GPG key | |
id: import-gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.VM_BOT_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.VM_BOT_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
git_config_global: true | |
- name: Generate docs | |
run: | |
make gen-docs | |
working-directory: __vm-helm-charts | |
- name: Copy docs | |
id: update | |
run: | | |
rsync -zarv \ | |
--include="*/" \ | |
--include="*.webp" \ | |
--include="*.md" \ | |
--exclude="*" \ | |
charts/ ../__vm-docs/content/helm/ | |
cp *.md ../__vm-docs/content/helm/ | |
echo "SHORT_SHA=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_OUTPUT | |
cp -f README.md ${{ runner.temp }}/README.md | |
for readme in $(find charts/*/README.md) | |
do | |
mkdir -p $(dirname ${{ runner.temp }}/$readme) | |
cp -f $readme ${{ runner.temp }}/$readme | |
done | |
working-directory: __vm-helm-charts | |
- name: Push to vmdocs | |
run: | | |
git config --global user.name "${{ steps.import-gpg.outputs.email }}" | |
git config --global user.email "${{ steps.import-gpg.outputs.email }}" | |
if [[ -n $(git status --porcelain) ]]; then | |
git add content/helm | |
git commit -S -m "sync docs with VictoriaMetrics/helm-docs commit: ${{ steps.update.outputs.SHORT_SHA }}" | |
git push | |
fi | |
working-directory: __vm-docs | |
env: | |
GH_TOKEN: "${{ secrets.VM_BOT_GH_TOKEN }}" | |
GITHUB_TOKEN: "${{ secrets.VM_BOT_GH_TOKEN }}" | |
- name: Checkout to pages | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
path: __vm-helm-charts | |
- name: Synchronize docs | |
run: | | |
cp -f ${{ runner.temp }}/README.md . | |
cp -fr ${{ runner.temp }}/charts ./ | |
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then | |
git add README.md | |
git add charts/*/README.md | |
git commit -S -m "Synchronize docs" | |
git push origin gh-pages | |
fi | |
working-directory: __vm-helm-charts | |
env: | |
GH_TOKEN: "${{ secrets.VM_BOT_GH_TOKEN }}" | |
GITHUB_TOKEN: "${{ secrets.VM_BOT_GH_TOKEN }}" |