Skip to content

Merge pull request #154 from andreer/revert-153-patch-4 #832

Merge pull request #154 from andreer/revert-153-patch-4

Merge pull request #154 from andreer/revert-153-patch-4 #832

# 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: []
# schedule:
# # 5:40 UTC daily
# - cron: "40 5 * * *"
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
working-directory: .
run: |
apt update && apt -y install curl
mkdir -p opt
VESPA_CLI_VERSION=$(curl -fsSL https://api.github.com/repos/vespa-engine/vespa/releases/latest | grep -Po '"tag_name": "v\K.*?(?=")')
curl -fsSL https://github.com/vespa-engine/vespa/releases/download/v${VESPA_CLI_VERSION}/vespa-cli_${VESPA_CLI_VERSION}_linux_amd64.tar.gz | \
tar -zxf - -C opt
ln -fs ./opt/*/bin/vespa
# Find Vespa version of current production deployment
- name: Find compile version
working-directory: .
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
working-directory: .
run: mvn -B package -Dvespa.compile.version="$(cat target/vespa.compile.version)"
# Deploy to Vespa Cloud using Vespa CLI
- name: Deploy to Vespa Cloud
working-directory: .
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