Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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 }}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
4 changes: 3 additions & 1 deletion tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down