Files
zhanggy 263f5d60a3 ci(workflows): 更新发布工作流的文件匹配模式
修改发布工作流中文件上传的匹配模式,仅包含特定的发布文件
移除package.json中不再需要的变更日志分类
2025-10-30 11:53:54 +08:00

111 lines
3.0 KiB
YAML

name: Publish Release
on:
push:
branches:
- main
# 在同一个工作流中处理发布任务
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
issues: write
pull-requests: write
jobs:
publish:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Configure Git to use HTTPS instead of SSH
run: |
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: |
- recursive: true
args: [--frozen-lockfile=false]
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
env:
NPM_CONFIG_LEGACY_PEER_DEPS: true
- name: Setup Git user
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Bump version and generate changelog
shell: bash
run: |
# 根据 commit 信息自动更新版本和生成 changelog
pnpm release
# 获取新版本号
version=$(node -p "require('./package.json').version")
echo "VERSION=$version" >> $GITHUB_ENV
echo "Version set to: $version"
- name: Push changes
run: |
git push origin main
git tag "v${{ env.VERSION }}"
git push origin "v${{ env.VERSION }}"
- name: Build for Windows
run: |
pnpm build:win
env:
# 禁用 Windows 代码签名
WIN_CSC_KEY_PASSWORD: ''
# GitHub token 用于发布
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.VERSION }}
name: Release v${{ env.VERSION }}
# body_path: CHANGELOG.md
draft: false
prerelease: false
files: |
release/**/*.exe
release/**/*.exe.blockmap
release/**/latest.yml
release/**/app-update.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Create GitHub Release
# uses: softprops/action-gh-release@v2
# with:
# tag_name: v${{ env.VERSION }}
# name: Release v${{ env.VERSION }}
# body_path: CHANGELOG.md
# draft: false
# prerelease: false
# files: |
# release/${{ env.VERSION }}/*
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}