# Workflow's jobs jobs: # job's id release: # job's name name:buildandreleaseelectronapp
创建矩阵定义 mac 和 windows 双运行环境
# main.yml
# Workflow's name name:BuildElectronAppForWin/Mac
# Workflow's trigger on: push: tags: -'v*.*.*'
# Workflow's jobs jobs: # job's id release: # job's name name:buildandreleaseelectronapp # the type of machine to run the job on runs-on:${{matrix.os}} # create a build matrix for jobs strategy: matrix: os: [windows-2019, macos-10.15]
# Workflow's jobs jobs: # job's id release: # job's name name:buildandreleaseelectronapp # the type of machine to run the job on runs-on:${{matrix.os}} # create a build matrix for jobs strategy: matrix: os: [windows-2019, macos-10.15]
# Workflow's jobs jobs: # job's id release: # job's name name:buildandreleaseelectronapp # the type of machine to run the job on runs-on:${{matrix.os}} # create a build matrix for jobs strategy: matrix: os: [windows-2019, macos-10.15]
# Workflow's jobs jobs: # job's id release: # job's name name:buildandreleaseelectronapp # the type of machine to run the job on runs-on:${{matrix.os}} # create a build matrix for jobs strategy: matrix: os: [windows-2019, macos-10.15]
# Workflow's jobs jobs: # job's id release: # job's name name:buildandreleaseelectronapp # the type of machine to run the job on runs-on:${{matrix.os}} # create a build matrix for jobs strategy: matrix: os: [windows-2019, macos-10.15]
# Workflow's jobs jobs: # job's id release: # job's name name:buildandreleaseelectronapp # the type of machine to run the job on runs-on:${{matrix.os}} # create a build matrix for jobs strategy: matrix: os: [windows-2019, macos-10.15]
很不幸,我的代码没有一次性跑通,它出现了错误:GitHub Personal Access Token is not set, neither programmatically, nor using env “GH_TOKEN” 。于是,我搜索得知解决方案如下: 1、得到我们的 Github Token 2、将 Github Token 配置在项目的环境变量中
# step4: build app for mac/win -name:buildwindowsapp if:matrix.os=='windows-2019' run:| npm run electron:build-win env: GH_TOKEN:bef0b46667d2b13f8asdasdasd762873af59f71c
-name:buildmacapp if:matrix.os=='macos-10.15' run:| npm run electron:build env: GH_TOKEN:bef0b46667d2b13f8asdasdasd762873af59f71c
注意,上面的 GH_TOKEN 请替换成你自己的!!!
出现错误:Windows 的 Power Shell 不支持 | 符号
这个解决方案倒是比较简单,就是将 cleanup artifacts 这一步再次用 if 语句判断:这样 Windows 是 (.exe),Mac 是 (.dmg),这就避免了出现 | 符号了。