feat: cicd
All checks were successful
Build and Deploy / deploy (push) Successful in 6m19s

This commit is contained in:
xiaolipro 2026-09-05 16:18:09 +08:00
parent ef4280ef0f
commit cdff57f8c3
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,34 @@
# 复制到 tracks .gitea/workflows/deploy.yml
name: Build and Deploy
on:
push:
branches: [master, main]
workflow_dispatch:
env:
CSPROJ: src/TrackCenter.Api/TrackCenter.Api.csproj
IMAGE_NAME: track_api
DEPLOY_NAME: track-api
CONTAINER_NAME: track-api
TCR_REGISTRY: ccr.ccs.tencentyun.com
TCR_NAMESPACE: ideship
jobs:
deploy:
runs-on: k3s-host
steps:
- name: Build and deploy
run: |
set -euxo pipefail
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
TAG="${{ gitea.sha }}"
IMG="${{ env.TCR_REGISTRY }}/${{ env.TCR_NAMESPACE }}/${{ env.IMAGE_NAME }}:${TAG}"
REPO="${{ gitea.repository }}"
test -n "$REPO" && [[ "$REPO" == */* ]]
echo "REPO=$REPO TAG=$TAG host=$(hostname)"
cd /data/k3s
./scripts/ci-publish-container.sh "$REPO" "${{ env.CSPROJ }}" \
"${{ env.IMAGE_NAME }}" "$TAG" "$TAG"
./scripts/ci-deploy-api.sh "${{ env.DEPLOY_NAME }}" \
"${{ env.CONTAINER_NAME }}" "$IMG"

View File

@ -19,6 +19,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution
.gitignore = .gitignore
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
.gitea\workflows\deploy.yml = .gitea\workflows\deploy.yml
EndProjectSection
EndProject
Global