Browse Source

Publish electron apps on release (#2780)

* Publish electron apps on release

* rename jobs

* fix lint
Ivan Rukhavets 4 years ago
parent
commit
9cc39d5a07
3 changed files with 37 additions and 10 deletions
  1. 25 2
      .github/workflows/push-master.yml
  2. 6 1
      i18next-scanner.config.js
  3. 6 7
      package.json

+ 25 - 2
.github/workflows/push-master.yml

@@ -5,10 +5,10 @@ on:
       - master
 
 jobs:
-  master:
+  release-www:
     strategy:
       matrix:
-        step: ['build:release:www', 'build:release:electron']
+        step: ['build:release:www']
     name: ${{ matrix.step }}
     if: "! contains(github.event.head_commit.message, '[CI Skip]') && github.repository == 'polkadot-js/apps'"
     runs-on: ubuntu-latest
@@ -27,6 +27,29 @@ jobs:
       run: |
         yarn install --immutable | grep -v 'YN0013'
         yarn ${{ matrix.step }}
+  release-electron:
+    strategy:
+      matrix:
+        os: [macos-latest, ubuntu-latest, windows-latest]
+    runs-on: ${{ matrix.os }}
+    if: "! contains(github.event.head_commit.message, '[CI Skip]') && github.repository == 'polkadot-js/apps'"
+    name: ${{ matrix.step }}
+
+    steps:
+      - uses: actions/checkout@v1
+        with:
+          token: ${{ secrets.GH_PAT }}
+
+      - name: Build/release Electron app
+        uses: samuelmeuli/action-electron-builder@v1
+        with:
+          # GitHub token, automatically provided to the action
+          # (No need to define this secret in the repo settings)
+          github_token: ${{ secrets.github_token }}
+          build_script_name: build:release:electron
+          # If the commit is tagged with a version (e.g. "v1.0.0"),
+          # release the app after building
+          release: ${{ startsWith(github.ref, 'refs/tags/v') }}
 
   dummy:
     name: Dummy

+ 6 - 1
i18next-scanner.config.js

@@ -23,7 +23,12 @@ function transform (file, enc, done) {
 
     const parserHandler = (key, options) => {
       options.defaultValue = key;
-      options.ns = /packages\/(.*?)\/src/g.exec(file.path)[1].replace('page-', 'app-');
+
+      if (process.platform !== 'win32') {
+        options.ns = /packages\/(.*?)\/src/g.exec(file.path)[1].replace('page-', 'app-');
+      } else {
+        options.ns = /packages\\(.*?)\\src/g.exec(file.path)[1].replace('page-', 'app-');
+      }
 
       this.parser.set(key, options);
     };

+ 6 - 7
package.json

@@ -38,7 +38,6 @@
     "build": "yarn run build:i18n && yarn run build:code",
     "build:code": "NODE_ENV=production node_modules/@polkadot/dev/scripts/polkadot-dev-build-ts.js",
     "build:i18n": "i18next-scanner --config i18next-scanner.config.js && node ./scripts/i18nSort.js",
-    "build:release:electron": "echo \"Dummy\"",
     "build:release:ipfs": "node scripts/ipfsUpload.js",
     "build:release:ghpages": "yarn polkadot-ci-ghact-docs",
     "build:release:www": "yarn polkadot-ci-ghact-build && yarn build:release:ipfs && yarn build:release:ghpages",
@@ -48,12 +47,12 @@
     "build:electronRenderer": "cd packages/apps-electron && NODE_ENV=production webpack --config webpack.renderer.config.js",
     "build:devElectronMain": "cd packages/apps-electron && webpack --config webpack.main.config.js",
     "build:electronMain": "cd packages/apps-electron && NODE_ENV=production webpack --config webpack.main.config.js",
-    "prepackElectron": "yarn build:electron && yarn postinstall:electron",
-    "packElectron:test": "yarn prepackElectron && electron-builder --dir",
-    "packElectron:mac": "yarn prepackElectron && electron-builder build --mac",
-    "packElectron:win": "yarn prepackElectron && electron-builder build --win",
-    "packElectron:linux": "yarn prepackElectron && electron-builder build --linux",
-    "packElectron": "yarn prepackElectron && yarn clean:electronRelease && electron-builder build --linux --win --mac",
+    "build:release:electron": "yarn build && yarn build:electron && yarn postinstall:electron",
+    "packElectron:test": "yarn build:release:electron && electron-builder --dir",
+    "packElectron:mac": "yarn build:release:electron && electron-builder build --mac",
+    "packElectron:win": "yarn build:release:electron && electron-builder build --win",
+    "packElectron:linux": "yarn build:release:electron && electron-builder build --linux",
+    "packElectron": "yarn build:release:electron && yarn clean:electronRelease && electron-builder build --linux --win --mac",
     "docs": "echo \"skipping docs\"",
     "clean": "polkadot-dev-clean-build",
     "clean:electronBuild": "cd packages/apps-electron polkadot-dev-clean-build",