Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-the-gamer committed Oct 22, 2023
1 parent 53a31f0 commit 305aacc
Showing 1 changed file with 33 additions and 34 deletions.
67 changes: 33 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,8 @@ on:
- 'v*.*.*'

jobs:
# 任务:创建 release 版本
create-release:
runs-on: ubuntu-latest
outputs:
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }}

steps:
- uses: actions/checkout@v2
# 查询版本号(tag)
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"
# 根据查询到的版本号创建 release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: '${{ steps.get_version.outputs.VERSION }}'
release_name: 'app ${{ steps.get_version.outputs.VERSION }}'
body: 'See the assets to download this version and install.'

build-electron:
name: build and release electron app
needs: create-release
runs-on: ${{ matrix.os }}

# create a build matrix for jobs
Expand All @@ -57,18 +29,45 @@ jobs:
node-version: 16

# step3: npm install
- name: npm install
- name: Install npm dependencies
run: |
npm install && cd frontend && npm install
npm install
cd frontend
npm install
cd ../
# step4: build app for mac/win
# 安装依赖执行构建,以及推送 github release
- name: Install app dependencies and build it
- name: Build app

# package.json里面配置的编译命令
run: |
npm run build-app
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# step5: cleanup artifacts
- name: cleanup artifacts for windows
if: matrix.os == 'windows-latest'
run: |
npx rimraf "out/make/!(*.zip)"
- name: cleanup artifacts for macos
if: matrix.os == 'macos-latest'
run: |
npx rimraf "out/make/!(*.dmg)"
# step6: upload artifacts
- name: upload artifacts
uses: actions/upload-artifact@v2
with:
releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}
name: ${{ matrix.os }}
path: out/make

# step7: create release
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: "out/make/**"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 305aacc

Please sign in to comment.