Skip to content

Commit

Permalink
Create release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
hellofinch authored Jan 14, 2025
1 parent 408ef49 commit 38c2a5b
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Auto Release on Develop

on:
push:
branches:
- new-feat
tags:
- 'v*' # 可选:监听以 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: $LATEST_TAG"

# Step 2: 设置 Node.js 环境
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 22.12.0

# Step 3: 安装 Yarn
- name: Install Yarn
run: npm install -g yarn

# Step 4: 添加 .yarnrc.yml 文件
- name: Add .yarnrc.yml
run: |
echo "nodeLinker: node-modules" > webapp/.yarnrc.yml
# Step 5: 安装依赖并编译 WebApp
- name: Install and Build WebApp
run: |
cd webapp
yarn install
yarn build # 根据实际的编译命令修改
# Step 6: 准备发布文件
- name: Prepare Release Files
run: |
mkdir -p release
cp script/setup.bat release/ # 复制 setup.bat
cp dist/win-unpacked/PDFMathTranslate.exe release/
# Step 7: 打包为 ZIP 文件
- name: Create ZIP File
run: |
zip -r release.zip release
shell: bash

# Step 8: 创建 Release 并上传 ZIP 文件
- name: Create a Release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
body: |
PDFMathTranslate win client
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 38c2a5b

Please sign in to comment.