add k8s manifests and Gitea Actions CI workflow
Build and Deploy / build-and-deploy (push) Successful in 54m41s
Build and Deploy / build-and-deploy (push) Successful in 54m41s
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: |
|
||||
TAG=${{ gitea.sha }}
|
||||
docker build \
|
||||
-t mts.dgnr.us:5000/${{ gitea.repository }} \
|
||||
-t mts.dgnr.us:5000/${{ gitea.repository }}:$TAG \
|
||||
.
|
||||
|
||||
- run: |
|
||||
TAG=${{ gitea.sha }}
|
||||
docker push mts.dgnr.us:5000/${{ gitea.repository }} &
|
||||
docker push mts.dgnr.us:5000/${{ gitea.repository }}:$TAG &
|
||||
wait
|
||||
|
||||
- name: Install kubectl
|
||||
run: |
|
||||
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
|
||||
curl -sLO "https://dl.k8s.io/release/v1.35.0/bin/linux/${ARCH}/kubectl"
|
||||
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=mts.dgnr.us:5000/${{ gitea.repository }}:$TAG -n enka
|
||||
kubectl rollout status deployment/enka-api -n enka --timeout=180s
|
||||
Reference in New Issue
Block a user