Do not create the route as part of the build #44
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: | |
- "production" | |
paths-ignore: | |
- '.gitignore' | |
- 'CODEOWNERS' | |
- 'LICENSE' | |
- '*.md' | |
- '*.adoc' | |
- '*.txt' | |
- '.all-contributorsrc' | |
concurrency: | |
group: deployment | |
cancel-in-progress: false | |
jobs: | |
deploy: | |
if: github.repository == 'hibernate/replicate-jira' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: temurin | |
java-version: 21 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4.0.0 | |
with: | |
version: 'v3.13.3' | |
- name: Log in to OpenShift | |
uses: redhat-actions/oc-login@v1 | |
with: | |
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_INFRA_PROD }} | |
openshift_token: ${{ secrets.OPENSHIFT_TOKEN_INFRA_PROD }} | |
namespace: ${{ secrets.OPENSHIFT_NAMESPACE_INFRA_PROD }} | |
- name: Create ImageStream | |
run: | | |
oc create imagestream replicate-jira || true | |
# https://docs.openshift.com/container-platform/4.14/openshift_images/using-imagestreams-with-kube-resources.html | |
oc set image-lookup replicate-jira | |
- name: Retrieve OpenShift Container Registry URL | |
id: oc-registry | |
run: | | |
echo -n "OC_REGISTRY_URL=" >> "$GITHUB_OUTPUT" | |
oc get imagestream -o json | jq -r '.items[0].status.publicDockerImageRepository' | awk -F"[/]" '{print $1}' >> "$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: ${{ secrets.OPENSHIFT_TOKEN_INFRA_PROD }} | |
# Helm in particular needs semantic versions | |
# See https://github.com/helm/helm/issues/9342#issuecomment-775269042 | |
# See the parts about pre-release versions in https://semver.org/#semantic-versioning-specification-semver | |
# Ideally we should use a "+" before the SHA, but that won't work with Quarkus | |
# See https://github.com/quarkusio/quarkus/blob/da1a782e04b01b2e165d65474163050d497340c1/extensions/container-image/spi/src/main/java/io/quarkus/container/spi/ImageReference.java#L60 | |
- name: Generate app version | |
id: app-version | |
run: | | |
echo "VALUE=1.0.0-$(date -u '+%Y%m%d%H%M%S')-${{ github.sha }}" >> $GITHUB_OUTPUT | |
- name: Build and push app container image | |
run: | | |
./mvnw clean package \ | |
-Drevision="${{ steps.app-version.outputs.value }}" \ | |
-Dquarkus.container-image.build=true \ | |
-Dquarkus.container-image.push=true \ | |
-Dquarkus.container-image.registry="$(oc get imagestream -o json | jq -r '.items[0].status.publicDockerImageRepository' | awk -F"[/]" '{print $1}')" \ | |
-Dquarkus.container-image.group="$(oc project --short)" \ | |
-Dquarkus.container-image.additional-tags=latest | |
- name: Deploy Helm charts | |
run: | | |
helm upgrade --install replicate-jira ./target/helm/openshift/replicate-jira |