Skip to content

Commit

Permalink
Merge branch 'new-feat' of github.com:hellofinch/PDFMathTranslate int…
Browse files Browse the repository at this point in the history
…o new-feat
  • Loading branch information
xzk1234 committed Jan 14, 2025
2 parents 5201af3 + 39900c3 commit 981c087
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Release win client

on:
# 自动触发
push:
branches:
- new-feat # 替换为你的分支名称
tags:
- 'v*'

# 手动触发
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest

steps:
# Step 1: 检出代码
- name: Checkout code
uses: actions/checkout@v3

# Step 2: 获取最新的 Tag
- name: Fetch Latest Tag
run: |
git fetch --tags
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
# Step 3: 打印最新的 Tag(调试用)
- name: Show Latest Tag
run: |
echo "Latest Tag: ${{ env.LATEST_TAG}}"
# Step 4: 设置 Node.js 环境为 v22.12.0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 22.12.0

# Step 5: 安装 Yarn
- name: Install Yarn
run: |
corepack enable
corepack prepare [email protected] --activate
# Step 6: 添加 .yarnrc.yml 文件
- name: Add .yarnrc.yml
run: |
echo "nodeLinker: node-modules" > webapp/.yarnrc.yml
# Step 7: 安装依赖并编译 Electron 应用
- name: Install Dependencies and Build
working-directory: webapp
run: |
yarn install
yarn build
# Step 8: 准备发布文件(仅复制 exe 文件)
- name: Prepare Release Files
run: |
mkdir -p release
cp script/setup.bat release/
cp webapp/dist/win-unpacked/PDFMathTranslate.exe release/
# Step 9: 打包为 ZIP 文件
- name: Create ZIP File
run: |
zip -r release.zip release
shell: bash

# Step 10: 创建 Release 并上传 ZIP 文件
- name: Create a Release
uses: actions/create-release@v1
with:
tag_name: ${{ env.LATEST_TAG }}
release_name: Release ${{ env.LATEST_TAG }}
body: |
release
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: release.zip
asset_name: release.zip
asset_content_type: application/zip

0 comments on commit 981c087

Please sign in to comment.