Merge branch 'feature/manual-cloud-release': 云端发布改为手动确认
All checks were successful
部署-局域网 / deploy (push) Successful in 4s
All checks were successful
部署-局域网 / deploy (push) Successful in 4s
This commit is contained in:
@@ -1,22 +1,34 @@
|
||||
name: 发布-云端
|
||||
# 审核 = 人工决定打不打 tag:push v* 标签即发布公网
|
||||
# 审核 = 人工在 Gitea Actions 点 Run workflow,填入已推送的 tag 版本 → 部署公网
|
||||
# 发布历史 = git tag 列表(git tag -l 'v*'),发布版本号 = tag 名
|
||||
on:
|
||||
push:
|
||||
tags: ['v*']
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: '发布版本(已推送的 tag,如 v1.0.4)'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: build-runner
|
||||
env:
|
||||
VERSION: ${{ inputs.version }}
|
||||
steps:
|
||||
- name: 校验版本号
|
||||
run: |
|
||||
if ! printf '%s' "$VERSION" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
|
||||
echo "❌ 版本号格式应为 vX.Y.Z,例如 v1.0.4"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 拉取代码(tag 版本)
|
||||
run: |
|
||||
git clone --depth 1 --branch "${GITHUB_REF_NAME}" "http://dafe:${{ secrets.GITHUB_TOKEN }}@192.168.51.66:3000/dafe/homepage.git" site
|
||||
git clone --depth 1 --branch "$VERSION" "http://dafe:${{ secrets.GITHUB_TOKEN }}@192.168.51.66:3000/dafe/homepage.git" site
|
||||
|
||||
- name: 注入发布版本号(缓存击穿,版本=tag 名)
|
||||
run: |
|
||||
cd site
|
||||
sed -i "s/?v=[0-9]*/?v=${GITHUB_REF_NAME}/g" index.html
|
||||
sed -i "s/?v=[0-9]*/?v=${VERSION}/g" index.html
|
||||
|
||||
- name: 发布到 ubuntu2(阿里云正式机,公网 www.shashann.com)
|
||||
env:
|
||||
@@ -32,5 +44,5 @@ jobs:
|
||||
|
||||
- name: 上线验证
|
||||
run: |
|
||||
curl -s -f -o /dev/null --resolve www.shashann.com:443:101.133.145.181 https://www.shashann.com/ || { echo "❌ 公网验证失败"; exit 1; }
|
||||
echo "✅ 云端已发布 ${GITHUB_REF_NAME} $(date '+%H:%M:%S')"
|
||||
curl -s -f -o /dev/null --noproxy '*' --resolve www.shashann.com:443:101.133.145.181 https://www.shashann.com/ || { echo "❌ 公网验证失败"; exit 1; }
|
||||
echo "✅ 云端已发布 ${VERSION} $(date '+%H:%M:%S')"
|
||||
|
||||
Reference in New Issue
Block a user