From 7a7bd9386e090bea092e659c736598769fea60bf Mon Sep 17 00:00:00 2001 From: hello8693 <1320998105@qq.com> Date: Wed, 28 Aug 2024 19:01:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(ci):=20=E4=BB=85=E5=9C=A8=E9=9D=9E?= =?UTF-8?q?=E9=A2=84=E5=8F=91=E8=A1=8C=E7=89=88=E6=9C=AC=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E4=B8=BAmacOS=E5=92=8CLinux=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E5=8F=91=E5=B8=83=E5=B7=A5=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改了构建和发布工件的GitHub操作工作流,以便仅在非预发行版本的情况下为macOS和Linux构建和发布工件。这包括在发布工作流中条件性地运行macOS和Linux构建任务,并相应地调整Windows构建任务。以前,工件会无条件地为所有操作系统构建和上传。 --- .github/workflows/build.yaml | 24 +----------------------- .github/workflows/publish.yaml | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 38da96a..f3770e8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - os: [ windows-latest, macos-latest, ubuntu-latest ] + os: [ windows-latest ] node-version: [ 20.x ] steps: @@ -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 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index e54b08b..7e5028b 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -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 @@ -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 @@ -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 }}