Files
JayuCloud/.gitea/workflows/回退sit环境nacos配置.yml
T
xiaowang 3ad792115c
环境分支晋级检查 / environment-promotion-source (pull_request_target) Successful in 1s
自动发布开发环境 Nacos 配置 / publish (push) Successful in 29s
fix(actions): use Chinese workflow filenames
2026-10-16 14:48:49 +08:00

55 lines
1.8 KiB
YAML

name: 回退测试环境 Nacos 配置
"on":
workflow_dispatch:
inputs:
snapshot_id:
description: 可选快照 ID,留空使用待回退快照
required: false
type: string
auto_rollback:
description: 是否由自动失败流程触发
required: false
type: boolean
concurrency:
group: release-sit
cancel-in-progress: false
jobs:
rollback:
runs-on: jayucloud
container:
options: >-
-v /opt/software/panel/apps/gitea/act_runner/salon-release:/salon-release
env:
NACOS_ENVIRONMENT: sit
RELEASE_STORE_ROOT: /salon-release
NACOS_SNAPSHOT_ID: ${{ inputs.snapshot_id }}
NACOS_SIT_URLS: ${{ secrets.NACOS_SIT_URLS }}
NACOS_SIT_USERNAME: ${{ secrets.NACOS_SIT_USERNAME }}
NACOS_SIT_PASSWORD: ${{ secrets.NACOS_SIT_PASSWORD }}
AUTO_ROLLBACK: ${{ inputs.auto_rollback }}
GITHUB_SERVER_URL: http://192.168.5.15:3000
steps:
- name: 检出回退脚本
shell: bash
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_SERVER_URL: http://192.168.5.15:3000
run: |
git init .
git remote add origin "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git"
git -c http.extraheader="Authorization: token $GITEA_TOKEN" fetch --no-tags --depth=1 origin "$GITHUB_SHA"
git checkout --detach "$GITHUB_SHA"
- name: 恢复并校验 Nacos
shell: bash
run: AUTO_ROLLBACK=${AUTO_ROLLBACK:-false} node .gitea/scripts/rollback-nacos.mjs
- name: 触发 SIT 应用恢复
if: inputs.auto_rollback == true
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AUTO_ROLLBACK: 'true'
run: node .gitea/scripts/dispatch-workflow.mjs sit环境回退上一个版本.yml refs/heads/sit