From 34c7ddc07cf334391d2a3b37e6dec17bf97bfa62 Mon Sep 17 00:00:00 2001 From: Marlon Saglia Date: Mon, 12 Aug 2024 14:17:18 +0200 Subject: [PATCH] new workflow --- ...ions.yml => auto-update-documentation.yml} | 48 +++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) rename .github/workflows/{auto-update-versions.yml => auto-update-documentation.yml} (53%) diff --git a/.github/workflows/auto-update-versions.yml b/.github/workflows/auto-update-documentation.yml similarity index 53% rename from .github/workflows/auto-update-versions.yml rename to .github/workflows/auto-update-documentation.yml index 634927e7d8..acb066e3af 100644 --- a/.github/workflows/auto-update-versions.yml +++ b/.github/workflows/auto-update-documentation.yml @@ -1,6 +1,6 @@ -name: Auto-update versions +name: Autoupdate Documentation # -# Takes care of updating the Vespa version in the documentation. +# Takes care of updating the Vespa documentation. # on: @@ -10,7 +10,12 @@ on: - cron: "0 0 * * *" repository_dispatch: - types: [update-vespa-version] + types: + - update-vespa-version + - update-vespa-cli-doc + + push: + branches: [auto-update-versions] # Temporary branch to trigger the workflow permissions: contents: write @@ -24,6 +29,9 @@ defaults: jobs: update-vespa-version: + # + # This job updates the Vespa version in the documentation. + # runs-on: ubuntu-24.04 steps: @@ -53,3 +61,37 @@ jobs: git pull --rebase git push fi + + update-vespa-cli-doc: + # + # This job updates the Vespa CLI documentation. + # + runs-on: ubuntu-latest + + env: + VESPA_CLI_DOC_DIR: en/reference/vespa-cli + + steps: + - uses: actions/checkout@v4 + + - name: Install Vespa CLI + uses: vespa-engine/setup-vespa-cli-action@v1 + + - name: Generate Vespa CLI Documentation + working-directory: ${{ env.VESPA_CLI_DOC_DIR }} + run: | + vespa gendoc . + + # Update documentation markdown files with some metadata. + for f in $(git status --short . | awk '{print $2}'); do + title=$(echo $f | sed 's/\(vespa_\)?\(.*\)\.md/\2/') + (echo -e "---\ntitle: $title\nrender_with_liquid: false\n---\n"; cat ${f}) > ${f}.new + mv ${f}.new ${f}; + done + + # ensure linka are to .html + sed -i'' 's/\(vespa.*\).md)/\1.html)/' *.md + # create links + sed -i'' 's#\(https://[a-z.]*vespa.ai/[^[:space:]]*\)#[\1](\1)#g' *.md + + git diff