Skip to content

Commit

Permalink
feat(ci): 仅在非预发行版本的情况下为macOS和Linux构建发布工件
Browse files Browse the repository at this point in the history
修改了构建和发布工件的GitHub操作工作流,以便仅在非预发行版本的情况下为macOS和Linux构建和发布工件。这包括在发布工作流中条件性地运行macOS和Linux构建任务,并相应地调整Windows构建任务。以前,工件会无条件地为所有操作系统构建和上传。
  • Loading branch information
hello8693 committed Aug 28, 2024
1 parent 6d385aa commit 7a7bd93
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 29 deletions.
24 changes: 1 addition & 23 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
os: [ windows-latest, macos-latest, ubuntu-latest ]
os: [ windows-latest ]
node-version: [ 20.x ]

steps:
Expand All @@ -27,31 +27,9 @@ jobs:
if: matrix.os == 'windows-latest'
run: yarn build:win

- name: Build and package for macOS
if: matrix.os == 'macos-latest'
run: yarn build:mac

- name: Build and package for Linux
if: matrix.os == 'ubuntu-latest'
run: yarn build:linux

- name: Upload artifact for Windows
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: ExamShowboard-Windows
path: dist/*.exe

- name: Upload artifact for macOS
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: ExamShowboard-macOS
path: dist/*.dmg

- name: Upload artifact for Linux
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: ExamShowboard-Linux
path: dist/*.AppImage
19 changes: 13 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ jobs:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
node-version: [20.x]
include:
- os: windows-latest
build_all: false
- os: macos-latest
build_all: true
- os: ubuntu-latest
build_all: true

steps:
- name: Checkout
Expand All @@ -30,11 +37,11 @@ jobs:
run: yarn build:win

- name: Build and package for macOS
if: matrix.os == 'macos-latest'
if: matrix.os == 'macos-latest' && github.event.release.prerelease == false
run: yarn build:mac

- name: Build and package for Linux
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' && github.event.release.prerelease == false
run: yarn build:linux

- name: Upload artifact for Windows
Expand All @@ -43,20 +50,20 @@ jobs:
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/*.exe
asset_name: ExamShowboard-Windows.exe
asset_name: ExamShowboard-Windows-amd64.exe
asset_content_type: application/octet-stream

- name: Upload artifact for macOS
if: matrix.os == 'macos-latest'
if: matrix.os == 'macos-latest' && github.event.release.prerelease == false
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/*.dmg
asset_name: ExamShowboard-macOS.dmg
asset_name: ExamShowboard-macOS-arm64.dmg
asset_content_type: application/octet-stream

- name: Upload artifact for Linux
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' && github.event.release.prerelease == false
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
Expand Down

0 comments on commit 7a7bd93

Please sign in to comment.