Skip to content

chore(deps): update plugin io.spring.dependency-management to v1.1.7 … #465

chore(deps): update plugin io.spring.dependency-management to v1.1.7 …

chore(deps): update plugin io.spring.dependency-management to v1.1.7 … #465

name: Build and Publish
on:
push:
branches: [ master ]
paths:
- 'src/**'
- 'pom.xml'
- 'build.gradle'
jobs:
build-and-push-docker-image:
name: Build Docker image and push to repositories
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Build image and push to GitHub Container Registry
uses: docker/build-push-action@v6
id: docker_build
with:
context: .
tags: |
ghcr.io/damingerdai/hoteler:${{ github.sha }}
push: ${{ github.ref == 'refs/heads/master' }}
platforms: linux/amd64,linux/arm64
provenance: true
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
deploy-to-kubernetes:
needs: build-and-push-docker-image
name: Deploy to kubernetes
runs-on: ubuntu-latest
steps:
- name: Authenticate to k3s
uses: Azure/k8s-set-context@v4
with:
kubeconfig: ${{ secrets.KUBE_CONFIG }}
- name: Deploy to k3s
run: |-
kubectl set image deployment/hoteler-api hoteler-api=ghcr.io/damingerdai/hoteler:${{ github.sha }} -n hoteler-namespace
kubectl rollout status deployment/hoteler-api -n hoteler-namespace