'修改脚本2'

This commit is contained in:
2026-04-07 22:04:40 +08:00
parent 2789cc5f04
commit b88a74b4a1
2 changed files with 25 additions and 14 deletions

View File

@@ -1,33 +1,42 @@
name: Local-Windows-CI-CD
name: Debug-Deploy-Workflow
on:
push:
tags:
- "v*"
branches:
- main # 暂时允许推送到 main 分支也触发,方便你测试流程
jobs:
deploy-job:
# 匹配刚才在 config.yaml 里设置的标签
runs-on: windows
runs-on: windows # 确保你的 config.yaml 里标签匹配
steps:
- name: Checkout Code
- name: 1. 检查代码检出
uses: actions/checkout@v4
with:
fetch-depth: 0 # 获取完整历史以便读取 tag
fetch-depth: 0
# 1. 注入 Secrets 到环境变量 (Gitea 会自动注入)
# 这里直接调用你写的 node 脚本
- name: Run Node Deploy Script
shell: cmd # 指定使用 Windows 命令行
- name: 2. 打印环境信息
shell: cmd
run: |
pnpm install
node deploy.js
echo "当前目录: %CD%"
node -v
pnpm -v
echo "当前 Tag/分支: ${{ github.ref_name }}"
- name: 3. 安装依赖 (利用本地缓存)
shell: cmd
run: pnpm install --prefer-offline
- name: 4. 执行部署脚本
shell: cmd
run: node deploy.js
env:
# 将 Gitea 的 Secrets 映射给脚本使用的环境变量
# 显式传入所有变量,确保脚本能读到
SENTRY_URL: ${{ secrets.GLITCHTIP_URL }}
SENTRY_AUTH_TOKEN: ${{ secrets.GLITCHTIP_TOKEN }}
SENTRY_ORG: ${{ secrets.GLITCHTIP_ORG }}
SENTRY_PROJECT: ${{ secrets.GLITCHTIP_PROJECT }}
# 脚本中用到的远程部署信息也可以在这里映射
# 如果脚本里写死了就不需要,如果没写死建议映射
# 调试开关:让脚本输出更多信息
NODE_ENV: production

View File

@@ -2,6 +2,8 @@ const { execSync } = require('node:child_process');
const fs = require('node:fs');
const path = require('node:path');
console.log(`脚本开始运行了!时间:${new Date().toLocaleString()}`);
console.log('环境变量检查 SENTRY_URL:', process.env.SENTRY_URL);
// --- 【配置区】 ---
const CONFIG = {
// 1. 开发源码所在的根目录