feat(cicd): move deploy pipeline to Gitea Actions
- .gitea/workflows/deploy.yaml: test → build ARM64 → push to Gitea registry → kubectl set image on push to main - Remove .github/workflows/deploy.yml (GitHub kept as test-only backup) Requires Gitea Actions secrets: GITEA_REGISTRY_PASSWORD, KUBECONFIG_B64. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3b294e2e82
commit
2e0163e2b2
52
.gitea/workflows/deploy.yaml
Normal file
52
.gitea/workflows/deploy.yaml
Normal file
@ -0,0 +1,52 @@
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Run tests
|
||||
run: go test ./...
|
||||
|
||||
deploy-finance:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea registry
|
||||
run: |
|
||||
echo "${{ secrets.GITEA_REGISTRY_PASSWORD }}" \
|
||||
| docker login git.gugagr.xyz -u admin --password-stdin
|
||||
|
||||
- name: Build and push finance-api
|
||||
run: |
|
||||
docker build \
|
||||
-t git.gugagr.xyz/admin/homelab_finance-api:${{ gitea.sha }} \
|
||||
-f apps/finance/services/api/Dockerfile \
|
||||
.
|
||||
docker push git.gugagr.xyz/admin/homelab_finance-api:${{ gitea.sha }}
|
||||
|
||||
- name: Install kubectl
|
||||
run: |
|
||||
curl -sSLo kubectl \
|
||||
https://dl.k8s.io/release/v1.30.0/bin/linux/arm64/kubectl
|
||||
install -m 0755 kubectl /usr/local/bin/kubectl
|
||||
|
||||
- name: Deploy
|
||||
run: |
|
||||
mkdir -p ~/.kube
|
||||
echo "${{ secrets.KUBECONFIG_B64 }}" | base64 -d > ~/.kube/config
|
||||
kubectl set image deployment/api \
|
||||
api=git.gugagr.xyz/admin/homelab_finance-api:${{ gitea.sha }} \
|
||||
-n finance
|
||||
kubectl rollout status deployment/api -n finance --timeout=120s
|
||||
50
.github/workflows/deploy.yml
vendored
50
.github/workflows/deploy.yml
vendored
@ -1,50 +0,0 @@
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
deploy-finance:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Gitea registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.gugagr.xyz
|
||||
username: admin
|
||||
password: ${{ secrets.GITEA_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push finance-api
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: apps/finance/services/api/Dockerfile
|
||||
platforms: linux/arm64
|
||||
push: true
|
||||
tags: git.gugagr.xyz/admin/homelab_finance-api:${{ github.sha }}
|
||||
cache-from: type=registry,ref=git.gugagr.xyz/admin/homelab_finance-api:buildcache
|
||||
cache-to: type=registry,ref=git.gugagr.xyz/admin/homelab_finance-api:buildcache,mode=max
|
||||
|
||||
- name: Deploy to VPS
|
||||
uses: appleboy/ssh-action@v1
|
||||
with:
|
||||
host: ${{ secrets.VPS_HOST }}
|
||||
username: ${{ secrets.VPS_USER }}
|
||||
key: ${{ secrets.VPS_SSH_KEY }}
|
||||
script: |
|
||||
kubectl set image deployment/api \
|
||||
api=git.gugagr.xyz/admin/homelab_finance-api:${{ github.sha }} \
|
||||
-n finance
|
||||
kubectl rollout status deployment/api -n finance --timeout=120s
|
||||
Loading…
x
Reference in New Issue
Block a user