Files
api/.github/workflows/build.yml
T
dmgnr 2ad53df691
Build and Deploy / build-and-deploy (push) Successful in 2m34s
ci: switch registry host
2026-07-05 07:57:09 +00:00

41 lines
1.3 KiB
YAML

name: Build and Deploy
on:
workflow_dispatch:
push:
branches:
- main
- dev
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and Install kubectl
run: |
TAG=${{ gitea.sha }}
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
docker build \
-t registry.neko-piranha.ts.net/${{ gitea.repository }} \
-t registry.neko-piranha.ts.net/${{ gitea.repository }}:$TAG --push \
. &
curl -sLO "https://dl.k8s.io/release/v1.35.0/bin/linux/${ARCH}/kubectl" &
wait
chmod +x kubectl
mv kubectl /usr/local/bin/kubectl
- name: Configure kubectl
run: |
kubectl config set-cluster astral --server=https://100.75.220.33:6443 --insecure-skip-tls-verify=true
kubectl config set-credentials ci-deployer --token=${{ secrets.KUBE_TOKEN }}
kubectl config set-context astral --cluster=astral --user=ci-deployer --namespace=enka
kubectl config use-context astral
- name: Deploy to k3s
run: |
TAG=${{ gitea.sha }}
kubectl set image deployment/enka-api enka-api=registry.neko-piranha.ts.net/${{ gitea.repository }}:$TAG -n enka
kubectl rollout status deployment/enka-api -n enka --timeout=180s