From bb7408dbe941c97c1e64ab4e86155724efccc539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Mon, 15 Apr 2024 10:48:08 +0800 Subject: [PATCH] chore:workflow-build --- .github/workflows/build.yml | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..f650bde1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,67 @@ +name: "Build" +on: + push: + +jobs: + build-linux: + if: ${{ ! startsWith(github.event.head_commit.message, 'build:') }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target_platform: [linux,darwin] + target_arch: [x64, arm64] + steps: + - name: Clone Main Repository + uses: actions/checkout@v4 + with: + repository: 'NapNeko/NapCat' + submodules: true + token: ${{ secrets.NAPCAT_BUILD }} + - name: Use Node.js 20.X + uses: actions/setup-node@v4 + with: + node-version: 20.x + - name: Build NuCat Linux + run: | + npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }} + npm run build:prod + cd dist + npm i --omit=dev --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }} + cd .. + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: NapCat.${{ matrix.target_platform }}.${{ matrix.target_arch }} + path: dist + build-win32: + if: ${{ ! startsWith(github.event.head_commit.message, 'build:') }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target_platform: [win32] + target_arch: [x64] + steps: + - name: Clone Main Repository + uses: actions/checkout@v4 + with: + repository: 'NapNeko/NapCat' + submodules: true + token: ${{ secrets.NAPCAT_BUILD }} + - name: Use Node.js 20.X + uses: actions/setup-node@v4 + with: + node-version: 20.x + - name: Build NuCat Linux + run: | + npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }} + npm run build:prod + cd dist + npm i --omit=dev --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }} + cd .. + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: NapCat.${{ matrix.target_platform }}.${{ matrix.target_arch }} + path: dist \ No newline at end of file