This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
name: deploy-production
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
action:
|
||||
description: deploy 或 writeback
|
||||
required: true
|
||||
default: deploy
|
||||
sha:
|
||||
description: 验收过的完整提交 SHA
|
||||
required: true
|
||||
bundle:
|
||||
description: release.json 的完整 SHA256
|
||||
required: true
|
||||
task:
|
||||
description: 对应的 HiFox 任务 UUID
|
||||
required: true
|
||||
confirm:
|
||||
description: deploy-production 或 retry-writeback
|
||||
required: true
|
||||
approval:
|
||||
description: 首次部署的发布人签名(Base64);仅补回写时留空
|
||||
required: false
|
||||
|
||||
concurrency:
|
||||
group: cloud-test-governance-main-production
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
guard:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: 核对手动入口及发布输入
|
||||
run: |
|
||||
set -eu
|
||||
test "$GITHUB_EVENT_NAME" = workflow_dispatch
|
||||
test "$GITHUB_REPOSITORY" = Weknora/knowledge-governance
|
||||
test "$GITHUB_REF" = refs/heads/main
|
||||
case "$GITHUB_SERVER_URL" in
|
||||
https://gitea.zheromiku.top|http://192.168.50.223:3000) ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
git init -q .
|
||||
git fetch -q --depth 200 "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" refs/heads/main
|
||||
git checkout -q --detach "$GITHUB_SHA"
|
||||
test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
|
||||
python3 scripts/production_cd.py guard --event "$GITHUB_EVENT_PATH"
|
||||
|
||||
publish:
|
||||
needs: [guard]
|
||||
runs-on: kg-production-cd
|
||||
timeout-minutes: 40
|
||||
steps:
|
||||
- name: 取同一提交的控制端代码
|
||||
run: |
|
||||
set -eu
|
||||
test "$GITHUB_EVENT_NAME" = workflow_dispatch
|
||||
test "$GITHUB_REPOSITORY" = Weknora/knowledge-governance
|
||||
test "$GITHUB_REF" = refs/heads/main
|
||||
case "$GITHUB_SERVER_URL" in
|
||||
https://gitea.zheromiku.top|http://192.168.50.223:3000) ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
git init -q .
|
||||
git fetch -q --depth 200 "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" refs/heads/main
|
||||
git checkout -q --detach "$GITHUB_SHA"
|
||||
test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
|
||||
- name: 调用云主站受限发布入口并读回回执
|
||||
env:
|
||||
KG_CD_SSH_KEY: ${{ secrets.KG_CD_SSH_KEY }}
|
||||
KG_CD_KNOWN_HOSTS: ${{ secrets.KG_CD_KNOWN_HOSTS }}
|
||||
KG_CD_SSH_HOST: ${{ vars.KG_CD_SSH_HOST }}
|
||||
KG_CD_SSH_PORT: ${{ vars.KG_CD_SSH_PORT }}
|
||||
run: python3 scripts/production_cd.py send --event "$GITHUB_EVENT_PATH"
|
||||
Reference in New Issue
Block a user