Browse Source

elctron-builder build file

hmt 5 years ago
parent
commit
a7a02293da

+ 19 - 16
.github/workflows/build.yml

@@ -1,26 +1,30 @@
 name: Build and release bangbib
-on: push
+on:
+  push:
+    branches:
+      - '**'
+    tags-ignore:
+      - '*.*.*'
 jobs:
   release:
     runs-on: ${{ matrix.os }}
     if: "!contains(github.event.head_commit.message, 'ci skip')"
     strategy:
       matrix:
-        os: [windows-latest]
+        os: [macos-latest, ubuntu-latest, windows-latest]
     steps:
       - name: Check out Git repository
         uses: actions/checkout@v1
-      - name: Cache node modules
-        uses: actions/cache@v1
-        env:
-          cache-name: cache-node-modules
+      - name: Get npm cache directory
+        id: npm-cache
+        run: |
+          echo "::set-output name=dir::$(npm config get cache)"
+      - uses: actions/cache@v1
         with:
-          path: node_modules
-          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
+          path: ${{ steps.npm-cache.outputs.dir }}
+          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
           restore-keys: |
-            ${{ runner.os }}-build-${{ env.cache-name }}-
-            ${{ runner.os }}-build-
-            ${{ runner.os }}-
+            ${{ runner.os }}-node-
       - name: Install Node.js, NPM
         uses: actions/setup-node@v1
         with:
@@ -28,18 +32,17 @@ jobs:
       - name: Install Dependencies
         run: npm install
       - name: Build
+        env:
+          THE_AUTHOR: ${{ secrets.AUTHOR }}
+          THE_EMAIL: ${{ secrets.EMAIL }}
         run: npm run build -m
       - name: Package
         run: npm run dist
       - name: show dir
         run: ls dist
-      - uses: actions/upload-artifact@v1
-        with:
-          name: bangbib
-          path: "./dist"
       - uses: ncipollo/release-action@v1
         with:
-          artifact: "./dist/bangbib.msi"
+          artifacts: "./dist/bangbib.msi,./dist/bangbib.dmg,./dist/bangbib.AppImage,./dist/bangbib.snap"
           allowUpdates: true
           tag: v1.0.${{ github.run_number }}
           token: ${{ secrets.GITHUB_TOKEN }}

BIN
build/icons/png/128x128.png


BIN
build/icons/png/16x16.png


BIN
build/icons/png/24x24.png


BIN
build/icons/png/256x256.png


BIN
build/icons/png/32x32.png


BIN
build/icons/png/48x48.png


BIN
build/icons/png/512x512.png


BIN
build/icons/png/64x64.png


+ 42 - 0
electron-builder.yml

@@ -0,0 +1,42 @@
+appId: im.hmt.bangbib
+productName: bangbib
+artifactName: bangbib.${ext}
+buildVersion: 1.0.${env.GITHUB_RUN_NUMBER}
+copyright: Copyright ${author}
+
+extraMetadata:
+  author:
+    name: ${env.THE_AUTHOR}
+    email: ${env.THE_EMAIL}
+
+files:
+  - ./build/**/*
+
+win:
+  icon: icons/icon.ico
+  target: msi
+
+linux:
+  icon: icons/icon.png
+  category: app.tools
+  executableName: bangbib
+  target:
+    - AppImage
+    - snap
+
+mac:
+  icon: icons/icon.icns
+  target: dmg
+
+dmg:
+  icon: icons/icon.icns
+  contents:
+  - x: 130
+    y: 220
+  - x: 550
+    y: 22
+    type: link
+    path: /Applications
+  window:
+    width: 680
+    height: 42

+ 0 - 0
build/icons/mac/icon.icns → icons/icon.icns


+ 0 - 0
build/icons/win/icon.ico → icons/icon.ico


+ 0 - 0
build/icons/png/1024x1024.png → icons/icon.png


+ 0 - 16
package.json

@@ -15,22 +15,6 @@
     "dev:electron": "electron .",
     "postinstall": "electron-builder install-app-deps"
   },
-  "build": {
-    "appId": "im.hmt.bangbib",
-    "productName": "bangbib",
-    "artifactName": "bangbib.${ext}",
-    "files": [
-      "./build/**/*"
-    ],
-    "win": {
-      "icon": "icons/win/icon.ico",
-      "target": [
-        {
-          "target": "msi"
-        }
-      ]
-    }
-  },
   "devDependencies": {
     "electron": "^8.0.2",
     "electron-builder": "^22.3.2",