From 13ea7de16b8249bdbaa54f1f3bddfa29110eed7b Mon Sep 17 00:00:00 2001 From: Marlon Saglia Date: Mon, 12 Aug 2024 11:19:49 +0200 Subject: [PATCH] feat: add auto-update versions workflow The new workflow added in `.github/workflows/auto-update-versions.yml` takes care of automatically updating the Vespa version in the project's documentation. The workflow is triggered either manually or on a daily schedule, and it fetches the latest Vespa version from the Maven repository and updates the relevant files in the repository. --- .github/workflows/auto-update-versions.yml | 52 ++++++++++++++++++++++ _config.yml | 11 +++-- 2 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/auto-update-versions.yml diff --git a/.github/workflows/auto-update-versions.yml b/.github/workflows/auto-update-versions.yml new file mode 100644 index 0000000000..e2dd85c7c7 --- /dev/null +++ b/.github/workflows/auto-update-versions.yml @@ -0,0 +1,52 @@ +name: Auto-update versions +# +# Takes care of updating the Vespa version in the documentation. +# + +on: + workflow_dispatch: # Allow manual triggering of the workflow + + schedule: + - cron: "0 0 * * *" + + repository_dispatch: + types: [update-vespa-version] + + # For testing purposes + push: + branches: [auto-update-versions] + +permissions: + contents: write + pull-requests: write + +jobs: + update-vespa-version: + 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\.]*\"/vespa_version: \"\${VESPA_VERSION}\"/" _config.yml + git diff + + changes=\$(git status --porcelain | wc -l) + if (( changes > 0 )); then + echo "Updating Vespa version in documentation to \${VESPA_VERSION}" + git commit -m "Update Vespa-version to \${VESPA_VERSION} MERGEOK" _config.yml + git pull --rebase + # Temp disabled while testing + # git push + fi diff --git a/_config.yml b/_config.yml index 7107586c4b..cfb705ce5b 100644 --- a/_config.yml +++ b/_config.yml @@ -55,7 +55,7 @@ exclude: search: namespace: "open" doc_type: "doc" - do_feed : true + do_feed: true do_index_removal_before_feed: false feed_endpoints: - url: https://vespacloud-docsearch.vespa-team.aws-us-east-1c.z.vespa-app.cloud/ @@ -75,12 +75,11 @@ search: - open_index.json defaults: - - - scope: - path : "" + - scope: + path: "" values: layout: "default" - index : true + index: true variables: - vespa_version: "8.388.11" + vespa_version: "CHANGED FOR TESTING PURPOSES"