fengling-console/.gitea/workflows/deploy.yml
movingsam 7bf4c41e41
Some checks failed
Build / build (push) Failing after 1m19s
Deploy to K8s / deploy (push) Failing after 3s
Build and Push Docker / build (push) Failing after 19s
fix: 修复 CI/CD workflow 文件 YAML 语法错误
- 移除错误的语法前缀 #XX|#
- 确保 workflow 文件可被 GitHub Actions 正确解析
2026-02-28 18:07:20 +08:00

62 lines
1.7 KiB
YAML

name: Deploy to K8s
on:
push:
branches: [main]
tags:
- "v*"
env:
REGISTRY: gitea.shtao1.cn
IMAGE_NAME: fengling/fengling-console
KUBECONFIG: ${{ secrets.KUBECONFIG }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract version
id: version
run: |
VERSION=${{ github.ref_name }}
if [[ $VERSION == v* ]]; then
VERSION=${VERSION#v}
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Login to Gitea
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: fengling
password: ${{ secrets.GITEATOKEN }}
- name: Deploy to Kubernetes
uses: k8s-toolset/gitops-deploy-action@main
with:
k8s-manifest: |
apiVersion: apps/v1
kind: Deployment
metadata:
name: fengling-console
namespace: fengling
spec:
replicas: 2
selector:
matchLabels:
app: fengling-console
template:
metadata:
labels:
app: fengling-console
spec:
containers:
- name: fengling-console
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
imagePullPolicy: Always
args: |
kubectl set image deployment/fengling-console fengling-console=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }} -n fengling
kubectl rollout status deployment/fengling-console -n fengling --timeout=300s