Skip to content

test: 修复Base64PasswordServiceTest的测试用例 #455

test: 修复Base64PasswordServiceTest的测试用例

test: 修复Base64PasswordServiceTest的测试用例 #455

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