feat: update readme #29
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
name: Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} # 使用矩阵策略来确定操作系统 | |
strategy: | |
matrix: # 这个定义会启用2个系统进行打包 | |
os: [macos-latest, windows-latest] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm install | |
- name: Build Electron package | |
# 不同系统会对应打包出不同类型安装包,打包完成会自动生成 Releases 草稿 | |
run: npm run build | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Publish release | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
# 编辑 Releases 草稿并发布 | |
run: gh release edit ${{ github.ref_name }} --draft=false | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |