You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
4.0 KiB
113 lines
4.0 KiB
# https://zhuanlan.zhihu.com/p/164901026
|
|
# https://www.antmoe.com/posts/18c087cf/
|
|
# https://zhuanlan.zhihu.com/p/348712087
|
|
# https://cloud.tencent.com/developer/article/1949574
|
|
# 此工作流的名字
|
|
name: Build
|
|
# 工作流的执行时机,可以设定为定时执行,每次push后执行,手动执行等
|
|
on:
|
|
# workflow_dispatch为在Github仓库的Actions面板中手动执行
|
|
# workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
# 工作/任务,这里的工作是可以并行的。
|
|
jobs:
|
|
# 工作的名称“编译windows版”
|
|
build:
|
|
# 运行的操作系统 windows
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
GH_TOKEN: ${{ secrets.ELECTRON_TOKEN }}
|
|
IS_ACTIONS: true
|
|
strategy:
|
|
matrix:
|
|
# https://www.likecs.com/ask-314443.html
|
|
node-version: [18.17.1]
|
|
os: [windows-2022, ubuntu-latest]
|
|
# 步骤
|
|
steps:
|
|
# 使用预制action:拉取最新的代码
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: master
|
|
# https://pnpm.io/zh/continuous-integration/#github-actions
|
|
- uses: pnpm/action-setup@v2.2.4
|
|
name: Install pnpm
|
|
id: pnpm-install
|
|
with:
|
|
version: 8.7.6
|
|
# 安装node
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'pnpm'
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
# 安装python
|
|
- name: Use Python 3.9.13
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.9.13
|
|
env:
|
|
PYTHON_VERSION: 3.9.13
|
|
# https://docs.microsoft.com/zh-cn/visualstudio/releases/2017/vs2017-system-requirements-vs
|
|
# 将windows设置成windows-2016,2016要取消支持了,可换成2022
|
|
# - name: set msvs
|
|
# run: npm config set msvs_version 2022
|
|
# https://github.com/wxWidgets/wxWidgets/blob/master/.github/workflows/ci_msw.yml
|
|
# https://github.com/microsoft/setup-msbuild
|
|
- name: Add msbuild to PATH
|
|
if: matrix.os == 'windows-2022'
|
|
uses: microsoft/setup-msbuild@v1.1
|
|
with:
|
|
vs-prerelease: true
|
|
# 步骤一的名称:
|
|
- name: Build
|
|
# 该步骤运行的终端命令,运行编译命令
|
|
run: npm run build
|
|
# 步骤二的名称:将编译后的结果上传
|
|
# - name: Upload File
|
|
# # 使用预制action:上传文件,可以将执行路径打包成zip上传
|
|
# uses: actions/upload-artifact@v3
|
|
# with:
|
|
# # 上传后文件的名称
|
|
# name: windows
|
|
# # 打包的路径以及文件过滤,此为仅打包dist目录下的exe文件
|
|
# path: out/*exe
|
|
- name: 读取当前版本号
|
|
id: version
|
|
uses: ashley-taylor/read-json-property-action@v1.1
|
|
with:
|
|
path: ./dist/package.json
|
|
property: version
|
|
- name: 读取描述文件
|
|
id: description
|
|
uses: juliangruber/read-file-action@v1
|
|
with:
|
|
path: ./changelog/${{steps.version.outputs.value}}.md
|
|
# step5: cleanup artifacts in dist_electron
|
|
# - name: 清理不必要的资产
|
|
# run: |
|
|
# npx rimraf "out/!(*.exe|*.dmg)"
|
|
# - name: Generate release tag
|
|
# id: tag
|
|
# run: |
|
|
# echo "::set-output name=release_tag::UserBuild_$(date +"%Y.%m.%d_%H-%M")"
|
|
- name: Generate release tag
|
|
id: tag
|
|
run: |
|
|
echo "::set-output name=release_tag::v${{steps.version.outputs.value}}"
|
|
# echo "release_tag=v${{steps.version.outputs.value}}" >> $GITHUB_OUTPUT
|
|
- name: release # https://github.com/softprops/action-gh-release/issues/20
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
tag_name: ${{ steps.tag.outputs.release_tag }}
|
|
name: ${{ steps.tag.outputs.release_tag }}
|
|
files: "out/*exe,out/*dmg,out/*AppImage,out/*yml"
|
|
body: ${{steps.description.outputs.content}}
|
|
draft: false
|
|
prerelease: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.ELECTRON_TOKEN }}
|
|
|