Update docs #309
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: | |
paths: | |
- CHANGELOG.md | |
- versions.yml | |
- UPGRADE.md | |
- docs/generated/raw/** | |
branches: ["master", "release-*", "!*-merge-master"] | |
tags: ["*"] | |
workflow_dispatch: {} | |
schedule: | |
- cron: 0 8 * * * | |
env: | |
DOCS_REPO: kumahq/kuma-website | |
OUTPUT_PATH: app/assets | |
VERSION_FILE: app/_data/versions.yml | |
EDITION: kuma | |
permissions: | |
contents: read | |
jobs: | |
generate-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
ref: master | |
path: repo | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version-file: repo/go.mod | |
- name: "sync docs" # loop over all the branches and generate the docs | |
run: | | |
cd repo | |
for b in $(jq -r '.[]' active-branches.json); do | |
name=$(echo "${b}" | sed 's/release-\(.*\)/\1.x/g' | sed 's/master/dev/g') | |
echo "${b} ${name}" | |
git checkout --force "${b}" | |
mkdir -p ../docs-build/${name}/raw | |
cp -R docs/generated/raw ../docs-build/${name}/ | |
mkdir -p ../docs-build/raw | |
if [[ "${b}" == "master" ]]; then | |
if [[ -f UPGRADE.md ]]; then | |
cp UPGRADE.md ../docs-build/raw/ | |
fi | |
cp CHANGELOG.md ../docs-build/raw/ | |
cp versions.yml ../docs-build/raw/ | |
fi | |
done | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
repository: ${{ env.DOCS_REPO }} | |
path: docs | |
- name: "update versions" | |
run: | | |
cd docs | |
cp -R ../docs-build/* ${{ env.OUTPUT_PATH }}/ | |
yq -i 'del(.[] | select(.edition == "${{ env.EDITION }}")) | . += load("${{ env.OUTPUT_PATH}}/raw/versions.yml")' ${{ env.VERSION_FILE }} | |
rm ${{ env.OUTPUT_PATH }}/raw/versions.yml | |
- name: Generate GitHub app token | |
id: github-app-token | |
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: "Create Pull Request" | |
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2 | |
with: | |
path: docs | |
commit-message: "chore(deps): update docs from repo source" | |
signoff: true | |
branch: chore/docs-sync-${{github.repository}} | |
body: | | |
Syncing docs from source code. | |
Generated by [action](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
delete-branch: true | |
title: "chore(deps): update docs from repo source" | |
draft: false | |
token: ${{ steps.github-app-token.outputs.token }} | |
committer: kumahq[bot] <110050114+kumahq[bot]@users.noreply.github.com> | |
author: kumahq[bot] <110050114+kumahq[bot]@users.noreply.github.com> |