Browse Source

更新 'nodejs/.github/workflows/build_electron_app.yml'

天问 4 years ago
parent
commit
36fcb59a63
2 changed files with 65 additions and 22 deletions
  1. 65 0
      nodejs/.github/workflows/build_electron_app.yml
  2. 0 22
      nodejs/.github/workflows/main.yml

+ 65 - 0
nodejs/.github/workflows/build_electron_app.yml

@@ -0,0 +1,65 @@
+name: Build Electron App
+
+on: 
+  push:
+    branchs: [master]
+  pull_request:
+    branchs: [master]
+
+jobs:
+  build:
+    runs-on: ${{matrix.os}}
+
+    strategy:
+      matrix:
+        os: [macos-latest, windows-latest]
+    
+    steps:
+      - uses: actions/check@v2
+
+      - name: Install Node.js NPM Yarn
+        uses: actions/setup-node@v1
+        with:
+          node-version: 12.16.3
+
+      - name: Get npm cache directory
+        id: npm-cache
+        run: |
+          echo "::set-output name=dir::$(npm config get cache)"
+      - uses: actions/cache@v1
+        with:
+          path: ${{ steps.npm-cache.outputs.dir }}
+          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
+          restore-keys: |
+            ${{ runner.os }}-node-
+
+      - name: Get yarn cache directory path
+        id: yarn-cache-dir-path
+        run: echo "::set-output name=dir::$(yarn cache dir)"
+
+      - uses: actions/cache@v1
+        id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
+        with:
+          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
+          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
+          restore-keys: |
+            ${{ runner.os }}-yarn-
+
+      - name: Build/release
+        uses: samuelmeuli/action-electron-builder@v1
+        with:
+          github_token: ${{secrets.github_token}}
+          release: ${{startWith(github.ref, 'refs/tags/v')}}
+          use_vue_cli: true
+      
+      - uses: actions/uplad-artifact@v2
+        with:
+          name: ReleaseApp-mac
+          path: dist_electron/*.dmg
+          if-no-files-found: ignore
+      
+      - uses: actions/uplad-artifact@v2
+        with:
+          name: ReleaseApp-win
+          path: dist_electron/*.exe
+          if-no-files-found: ignore

+ 0 - 22
nodejs/.github/workflows/main.yml

@@ -1,22 +0,0 @@
-- name: Get npm cache directory
-  id: npm-cache
-  run: |
-    echo "::set-output name=dir::$(npm config get cache)"
-- uses: actions/cache@v1
-  with:
-    path: ${{ steps.npm-cache.outputs.dir }}
-    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
-    restore-keys: |
-      ${{ runner.os }}-node-
-
-- name: Get yarn cache directory path
-  id: yarn-cache-dir-path
-  run: echo "::set-output name=dir::$(yarn cache dir)"
-
-- uses: actions/cache@v1
-  id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
-  with:
-    path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
-    key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
-    restore-keys: |
-      ${{ runner.os }}-yarn-