Skip to content

Commit

Permalink
Test extracting quarkus building as composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-eberle committed Feb 15, 2024
1 parent be670c2 commit 9b65241
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 32 deletions.
45 changes: 45 additions & 0 deletions .github/actions/k8s/build-deploy-quarkus/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "Build & Deploy Quarkus to k8s"
inputs:
github-token:
required: true
kube-config:
required: true


permissions:
contents: read
packages: write


runs:
using: "composite"
steps:
- 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: '${{ inputs.kube-config }}'

- 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=${{ inputs.github-token }}
2 changes: 0 additions & 2 deletions .github/actions/k8s/deploy-postgres/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ inputs:
default: app.kubernetes.io/name




runs:
using: "composite"
steps:
Expand Down
66 changes: 36 additions & 30 deletions .github/workflows/k8s-quarkus-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
pull_request:
branches: [ main ]

permissions:
contents: read
packages: write
#permissions:
# contents: read
# packages: write

jobs:
build:
Expand All @@ -23,35 +23,41 @@ jobs:
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: 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: build container
run: ./gradlew assemble -Dquarkus.container-image.build=true

- uses: azure/k8s-set-context@v3
- name: build & deploy quarkus
uses: ./.github/actions/k8s/build-deploy-quarkus
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 }}
github-token: ${{ secrets.GITHUB_TOKEN }}
kube-config: ${{ secrets.KUBECONFIG }}

- name: deploy postgres
uses: ./.github/actions/k8s/deploy-postgres
Expand Down

0 comments on commit 9b65241

Please sign in to comment.