From 21935a95a9f76ac8c37f8d4dc53d716442c32146 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Mon, 15 Jun 2020 03:59:10 +0900 Subject: [PATCH 1/3] possible to specify the platform to build package $ node tasks/build.js darwin or win32 or linux or none (all platforms) --- tasks/build.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/build.js b/tasks/build.js index 526211d9..6368a443 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -6,6 +6,8 @@ const archiver = require('archiver') const path = require('path') const fs = require('fs') +const targetPlatforms = process.argv[2] ? [process.argv[2]] : ['darwin', 'linux', 'win32'] + const config = { packager: { arch: 'x64', @@ -15,7 +17,7 @@ const config = { ignore: 'editor/', out: path.join(where.root, 'builds'), overwrite: true, - platform: ['darwin', 'linux', 'win32'] + platform: targetPlatforms }, packageName: { 'Thinreports Editor-darwin-x64': 'ThinreportsEditor-mac', From bfe8f3f05b29dde189a56d9f3716d8963f4ebb26 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Mon, 15 Jun 2020 03:59:45 +0900 Subject: [PATCH 2/3] add task for building package each platform --- package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 75572adc..1b1f6881 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,12 @@ "compile:javascript": "node tasks/compile.javascript.js", "compile:css": "node tasks/compile.css.js", "compile:template": "node tasks/compile.template.js", + "compile:prod": "cross-env NODE_ENV=production npm run compile", "build": "node tasks/build.js", - "release": "cross-env NODE_ENV=production npm run compile && npm run build", + "build:macos": "node tasks/build.js darwin", + "build:windows": "node tasks/build.js win32", + "build:linux": "node tasks/build.js linux", + "release": "npm run compile:prod && npm run build", "watch": "node tasks/watch.js", "postinstall": "cd app && npm install" }, From d65909fd52d830154c0a526c48d8c0786718a728 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Mon, 15 Jun 2020 04:01:28 +0900 Subject: [PATCH 3/3] job for building package and uploading packages to release --- .github/workflows/build.yml | 64 +++++++++++++++++++++++++++++++++++++ 1 file changed, 64 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..5d1e25ef --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,64 @@ +name: Build and release + +on: + push: + branches: + - build/** + tags: + - '*' + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + include: + - os: macos-latest + build: macos + - os: ubuntu-latest + build: linux + - os: windows-latest + build: windows + + steps: + - uses: actions/checkout@v2 + + - name: Setup Java JDK + uses: actions/setup-java@v1.3.0 + with: + java-version: 7 + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 2.7 + + - name: Install Node.js + uses: actions/setup-node@v1 + with: + node-version: 13 + - name: Install npm packages + run: npm install + + - name: Compile scripts + run: npm run compile:prod + + - name: Build ${{ matrix.build }} + run: npm run build:${{ matrix.build }} + + - name: Upload to artifact if not tagged + uses: actions/upload-artifact@v2 + if: "!startsWith(github.ref, 'refs/tags')" + with: + name: ${{ matrix.build }} + path: builds/*.zip + + - name: Release if tagged + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: builds/*.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}