Add deployment for db to quarkus-sync pipeline #25
Workflow file for this run
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: Quarkus Sync Build & Deploy on k8s | |
on: | |
push: | |
branches: [ main, feature/k8s-deployment ] | |
pull_request: | |
branches: [ main ] | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build: | |
name: build & push | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./bookstore-quarkus-sync | |
env: | |
QUARKUS_HTTP_ROOT_PATH: / | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: assemble | |
run: ./gradlew assemble | |
- name: build container | |
run: ./gradlew assemble -Dquarkus.container-image.build=true | |
- uses: azure/k8s-set-context@v3 | |
with: | |
method: kubeconfig | |
kubeconfig: '${{ secrets.KUBECONFIG }}' | |
- name: push & deploy to k8s | |
run: | | |
./gradlew assemble \ | |
-Dquarkus.kubernetes.deploy=true \ | |
-Dquarkus.container-image.group=${{ github.repository_owner }}/${{ github.event.repository.name }} \ | |
-Dquarkus.container-image.registry=ghcr.io \ | |
-Dquarkus.container-image.additional-tags=${{ github.sha }} \ | |
-Dquarkus.container-image.username=${{ github.actor }} \ | |
-Dquarkus.container-image.password=${{ secrets.GITHUB_TOKEN }} | |
- name: deploy postgres | |
uses: vimeda/[email protected] | |
with: | |
release: bookstore-quarkus-sync | |
namespace: 'default' | |
chart: 'oci://registry-1.docker.io/bitnamicharts/postgresql' | |
token: '${{ secrets.GITHUB_TOKEN }}' | |
values: | | |
global: | |
postgresql: | |
auth: | |
username: postgres | |
database: books-db | |
primary: | |
affinity: | |
podAntiAffinity: | |
requiredDuringSchedulingIgnoredDuringExecution: | |
- labelSelector: | |
matchExpressions: | |
- key: app.kubernetes.io/name | |
operator: In | |
values: | |
- bookstore-quarkus-sync | |
- key: app.kubernetes.io/managed-by | |
operator: In | |
values: | |
- quarkus | |
topologyKey: "kubernetes.io/hostname" | |
env: | |
KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}' |