This commit is contained in:
parent
ef4280ef0f
commit
cdff57f8c3
34
.gitea/workflows/deploy.yml
Normal file
34
.gitea/workflows/deploy.yml
Normal 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"
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user