From b660dc461354f633750a7aa4aff1b2d31597cfdd Mon Sep 17 00:00:00 2001 From: ZSCGR Date: Sun, 7 Dec 2025 15:59:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.github/workflows/release.?= =?UTF-8?q?yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 200b92d..b707857 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,6 @@ name: Release on: push: - branch: main tags: - 'v*' @@ -14,12 +13,28 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 0 # 必须抓取完整历史才能生成日志 - uses: actions/setup-node@v4 with: node-version: lts/* - - run: npx changelogithub + # 步骤 1: 本地生成 Changelog (不依赖 GitHub API) + - name: Generate Changelog + run: | + npx conventional-changelog-cli -p angular -i CHANGELOG.md -s + # 说明: 这会根据你的 commit 记录生成 CHANGELOG.md 文件 + + # 步骤 2: 发布 Release 到 Gitea + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + body_path: CHANGELOG.md # 把生成的内容作为 Release 的描述 + files: | # 如果你有构建产物想上传,写在这里 + # dist/app.js + # build/*.zip env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # 关键: 如果 softprops 无法自动识别 Gitea,有时需要指定 URL, + # 但通常 Gitea Runner 会自动注入 GITHUB_API_URL 环境变量, + # 所以大多数情况下直接用即可。 \ No newline at end of file