itfx/.gitea/workflows/deploy.yml
xiaolipro 997ccd867f
Some checks failed
Build and Deploy / deploy (push) Has been cancelled
更新 .gitea/workflows/deploy.yml
2026-09-04 16:08:50 +08:00

37 lines
1.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 复制到仓库 .gitea/workflows/deploy.yml
# 前置134: 24-setup-host-build.sh + 19-setup-act-runner.sh
name: Build and Deploy
on:
push:
branches: [master, main]
workflow_dispatch:
env:
CSPROJ: src/InterfaceForward.Api/InterfaceForward.Api.csproj
IMAGE_NAME: interfaceforward_api
DEPLOY_NAME: interfaceforward-api
CONTAINER_NAME: interfaceforward-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 }}"
REPO="${REPO:-${{ github.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"