ci: add Docker buildx cache for faster builds
This commit is contained in:
parent
564d664426
commit
d533a8111b
@ -84,6 +84,9 @@ jobs:
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
driver-opts: |
|
||||
image=moby/buildkit:buildx-stable-1
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
@ -109,33 +112,7 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
deploy:
|
||||
needs: docker
|
||||
runs-on: ubuntu-latest
|
||||
if: gitea.event_name == 'push' && (gitea.ref == 'refs/heads/main' || gitea.ref == 'refs/heads/master')
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up kubectl
|
||||
uses: azure/setup-kubectl@v3
|
||||
|
||||
- name: Configure kubectl
|
||||
run: |
|
||||
mkdir -p ~/.kube
|
||||
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > ~/.kube/config
|
||||
chmod 600 ~/.kube/config
|
||||
|
||||
- name: Deploy to Kubernetes
|
||||
run: |
|
||||
TAG=$(echo ${{ gitea.sha }} | cut -c1-7)
|
||||
sed -i "s|image:.*fengling-gateway.*|image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${TAG}|g" k8s/deployment.yaml
|
||||
kubectl apply -f k8s/deployment.yaml -n fengling
|
||||
kubectl apply -f k8s/service.yaml -n fengling
|
||||
kubectl rollout status deployment/fengling-gateway -n fengling --timeout=300s
|
||||
|
||||
- name: Verify deployment
|
||||
run: |
|
||||
kubectl get pods -n fengling -l app=fengling-gateway
|
||||
kubectl get services -n fengling fengling-gateway
|
||||
deploy:
|
||||
Loading…
Reference in New Issue
Block a user