Skip to content

fix(VESPANG-225): ensure documentation is only pushed when merged (#160) #842

fix(VESPANG-225): ensure documentation is only pushed when merged (#160)

fix(VESPANG-225): ensure documentation is only pushed when merged (#160) #842

# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
# See https://cloud.vespa.ai/en/automated-deployments for details
# VESPA_TEAM_VESPACLOUD_DOCSEARCH_API_KEY is an organization secret -
# this is used to deploy applications to Vespa Cloud
name: Deploy vespa-documentation-search to Vespa Cloud
on:
push:
branches:
- main
env:
VESPA_TEAM_VESPACLOUD_DOCSEARCH_API_KEY: ${{ secrets.VESPA_TEAM_VESPACLOUD_DOCSEARCH_API_KEY }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Check out the source code from the repository
- uses: actions/checkout@v3
# Vespa uses Java 17
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
# Get latest Vespa CLI
- name: Get Vespa CLI
uses: vespa-engine/setup-vespa-cli@1.x
# Find Vespa version of current production deployment
- name: Find compile version
run: mvn -B clean vespa:compileVersion -DapiKey="${VESPA_TEAM_VESPACLOUD_DOCSEARCH_API_KEY}"
# Build the application package and the tester bundle
- name: Build with Maven
run: mvn -B package -Dvespa.compile.version="$(cat target/vespa.compile.version)"
# Deploy to Vespa Cloud using Vespa CLI
- name: Deploy to Vespa Cloud
run: |
./vespa config set target cloud
./vespa config set application vespa-team.vespacloud-docsearch
export VESPA_CLI_API_KEY="${VESPA_TEAM_VESPACLOUD_DOCSEARCH_API_KEY}"
./vespa prod deploy \
--source-url "$(git config --get remote.origin.url | sed 's+git@\(.*\):\(.*\)\.git+https://\1/\2+')/commit/$(git rev-parse HEAD)"
# Refer to https://github.com/vespa-cloud/cord-19-search/blob/main/.github/workflows/deploy-vespa-cord-19-search.yaml
# for an example using mvn vespa:submit