From f81bf2d5929be9265d118ec232d3a51b753d2309 Mon Sep 17 00:00:00 2001 From: hello8693 <1320998105@qq.com> Date: Wed, 28 Aug 2024 19:47:28 +0800 Subject: [PATCH] =?UTF-8?q?ci(release):=20=E4=BC=98=E5=8C=96=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish.yaml | 50 ++++++++++------------------------ 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 0c37dbe..fad9a5a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,5 +1,4 @@ -# .github/workflows/publish.yaml -name: Build and Package Electron App on Release +name: Release Build and Package on: release: @@ -8,32 +7,23 @@ on: jobs: build: runs-on: ${{ matrix.os }} + if: github.event.release.prerelease == false || matrix.os == 'windows-latest' strategy: 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 - if: matrix.os == 'windows-latest' || github.event.release.prerelease == false uses: actions/checkout@v4.1.7 - name: Set up Node.js - if: matrix.os == 'windows-latest' || github.event.release.prerelease == false uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Install dependencies - if: matrix.os == 'windows-latest' || github.event.release.prerelease == false run: yarn install - name: Build and package for Windows @@ -41,40 +31,30 @@ jobs: run: yarn build:win - name: Build and package for macOS - if: matrix.os == 'macos-latest' && github.event.release.prerelease == false + if: matrix.os == 'macos-latest' run: yarn build:mac - name: Build and package for Linux - if: matrix.os == 'ubuntu-latest' && github.event.release.prerelease == false + if: matrix.os == 'ubuntu-latest' run: yarn build:linux - - name: Get version from package.json - id: get_version - run: echo "::set-output name=version::$(node -p \"require('./package.json').version\")" - - name: Upload artifact for Windows if: matrix.os == 'windows-latest' - uses: actions/upload-release-asset@v1 + uses: actions/upload-artifact@v4 with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: dist/dsz-exam-showboard-${{ steps.get_version.outputs.version }}-setup.exe - asset_name: ExamShowboard-Windows-amd64-${{ steps.get_version.outputs.version }}-setup.exe - asset_content_type: application/octet-stream + name: ExamShowboard-Windows + path: dist/*.exe - name: Upload artifact for macOS - if: matrix.os == 'macos-latest' && github.event.release.prerelease == false - uses: actions/upload-release-asset@v1 + if: matrix.os == 'macos-latest' + uses: actions/upload-artifact@v4 with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: dist/dsz-exam-showboard-${{ steps.get_version.outputs.version }}.dmg - asset_name: ExamShowboard-macOS-arm64-${{ steps.get_version.outputs.version }}.dmg - asset_content_type: application/octet-stream + name: ExamShowboard-macOS + path: dist/*.dmg - name: Upload artifact for Linux - if: matrix.os == 'ubuntu-latest' && github.event.release.prerelease == false - uses: actions/upload-release-asset@v1 + if: matrix.os == 'ubuntu-latest' + uses: actions/upload-artifact@v4 with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: dist/dsz-exam-showboard-${{ steps.get_version.outputs.version }}.AppImage - asset_name: ExamShowboard-Linux-amd64-${{ steps.get_version.outputs.version }}-setup.AppImage - asset_content_type: application/octet-stream + name: ExamShowboard-Linux + path: dist/*.AppImage