Merge pull request #188 from yrodiere/wait-indexing #171
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: | |
- "main" | |
- "production" | |
paths-ignore: | |
- '.gitignore' | |
- 'CODEOWNERS' | |
- 'LICENSE' | |
- '*.md' | |
- '*.adoc' | |
- '*.txt' | |
- '.all-contributorsrc' | |
concurrency: | |
group: deployment | |
cancel-in-progress: false | |
jobs: | |
deploy: | |
if: github.repository == 'quarkusio/search.quarkus.io' | |
runs-on: ubuntu-latest | |
env: | |
QUARKUS_PROFILE: ${{ github.ref == 'refs/heads/production' && 'prod' || 'staging' }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Set up Helm | |
uses: azure/[email protected] | |
with: | |
version: 'v3.13.3' | |
- name: Log in to OpenShift | |
uses: redhat-actions/oc-login@v1 | |
with: | |
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }} | |
openshift_token: ${{ github.ref == 'refs/heads/production' && secrets.OPENSHIFT_TOKEN_PROD || secrets.OPENSHIFT_TOKEN_DEV }} | |
namespace: ${{ github.ref == 'refs/heads/production' && secrets.OPENSHIFT_NAMESPACE_PROD || secrets.OPENSHIFT_NAMESPACE_DEV }} | |
- name: Create ImageStreams | |
run: | | |
oc create imagestream search-quarkus-io || true | |
oc create imagestream opensearch-custom || true | |
# https://docs.openshift.com/container-platform/4.14/openshift_images/using-imagestreams-with-kube-resources.html | |
oc set image-lookup search-quarkus-io | |
oc set image-lookup opensearch-custom | |
- name: Retrieve OpenShift Container Registry URL | |
id: oc-registry | |
run: | | |
echo -n "OC_REGISTRY_URL=" >> "$GITHUB_OUTPUT" | |
oc registry info >> "$GITHUB_OUTPUT" | |
- name: Log in to OpenShift Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ steps.oc-registry.outputs.OC_REGISTRY_URL }} | |
username: ignored | |
password: ${{ github.ref == 'refs/heads/production' && secrets.OPENSHIFT_TOKEN_PROD || secrets.OPENSHIFT_TOKEN_DEV }} | |
- name: Build container images and Helm charts, push app container image | |
run: | | |
./mvnw clean package \ | |
-Drevision="${{ github.sha }}" \ | |
-Dquarkus.container-image.build=true \ | |
-Dquarkus.container-image.push=true \ | |
-Dquarkus.container-image.registry="$(oc registry info)" \ | |
-Dquarkus.container-image.group="$(oc project --short)" | |
- name: Push OpenSearch container image | |
run: | | |
REMOTE_IMAGE_REF="$(oc registry info)/$(oc project --short)/opensearch-custom:latest" | |
# docker doesn't allow the `push source target` syntax, so we have to do this in two steps. | |
docker image tag "opensearch-custom:latest" "$REMOTE_IMAGE_REF" | |
docker push "$REMOTE_IMAGE_REF" | |
- name: Deploy Helm charts | |
run: | | |
helm upgrade --install search-quarkus-io ./target/helm/openshift/search-quarkus-io \ | |
-f ./src/main/helm/values.$QUARKUS_PROFILE.yaml |