forked from Byaidu/PDFMathTranslate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
408ef49
commit 38c2a5b
Showing
1 changed file
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |