Skip to content
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: ./.github/actions/k8s/deploy-postgres
with:
release-name: bookstore-quarkus-sync
anti-affinity-value: bookstore-quarkus-sync
kube-config: ${{ secrets.KUBECONFIG }}