Skip to content

Commit

Permalink
new workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
esolitos authored and gitbutler-client committed Aug 12, 2024
1 parent 0fb6a1a commit 8e5d110
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 55 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/auto-update-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Autoupdate Documentation
#
# Takes care of updating the Vespa documentation.
#

on:
workflow_dispatch: # Allow manual triggering of the workflow

schedule:
- cron: "0 0 * * *"

repository_dispatch:
types:
- update-vespa-version
- update-vespa-cli-doc

push:
branches: [auto-update-versions] # Temporary branch to trigger the workflow

permissions:
contents: write
pull-requests: write

defaults:
run:
# This ensures that options "pipefail" and "errexit" are set for all steps.
# Ref: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#defaultsrunshell
shell: bash

jobs:
update-vespa-version:
#
# This job updates the Vespa version in the documentation.
#
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4

- name: Setup Dependencies
run: |
sudo apt-get update
sudo apt-get install -y xq
- name: Get Latest Vespa version
run: |
VESPA_VERSION=$(curl -sSL https://repo1.maven.org/maven2/com/yahoo/vespa/parent/maven-metadata.xml | \
xq -x '/metadata/versioning/latest')
echo "Vespa version: $VESPA_VERSION"
sed -i'' "s/\(vespa_version:\) \"[0-9\.]*\"/\1 \"${VESPA_VERSION}\"/" _config.yml
git diff
# Check if there are changes to commit.
if [[ -n "$(git status --porcelain)" ]]; then
echo "Updating Vespa version in documentation to ${VESPA_VERSION}" >> $GITHUB_STEP_SUMMARY
git config --global user.email "[email protected]"
git config --global user.name "${{ github.actor}}"
git commit -m "Update Vespa-version to ${VESPA_VERSION} - MERGEOK" _config.yml
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: documentation/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 $(find . -name '*.md'); do
title=${f//.md/}
echo "Title: $title"
title=${title//.\//}
echo "Title: $title"
title=${title//_/ }
echo "Title: $title"
# (
# echo -e "---\ntitle: \$title\nrender_with_liquid: false\n---\n"
# cat ${f}) > ${f}.new
# mv \${f}.new \${f};
# done
# # link to .html
# sed -i.orig 's/\(vespa.*\).md)/\1.html)/' *.md
# # create links
# sed -i.orig 's#\(https://[a-z.]*vespa.ai/[^[:space:]]*\)#[\1](\1)#g' *.md
# rm *.orig
done
55 changes: 0 additions & 55 deletions .github/workflows/auto-update-versions.yml

This file was deleted.

0 comments on commit 8e5d110

Please sign in to comment.