From 1ac527117d60df311c3f0fae39052011bdb50d07 Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Tue, 24 Jul 2018 20:06:48 +0200 Subject: [PATCH] build(release): auto release on ci Integrate electron-builder with our ci process so that electron builds are created and published to a github release draft automatically. --- .travis.yml | 48 +++++++++++++---- appveyor.yml | 19 ++++--- package.json | 93 ++++++++++++++++++++------------ resources/{ => icons}/icon.icns | Bin resources/{ => icons}/icon.ico | Bin resources/{ => icons}/icon.png | Bin 6 files changed, 109 insertions(+), 51 deletions(-) rename resources/{ => icons}/icon.icns (100%) rename resources/{ => icons}/icon.ico (100%) rename resources/{ => icons}/icon.png (100%) diff --git a/.travis.yml b/.travis.yml index f0c75b9d..7de2df35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,14 @@ language: node_js env: global: - DEBUG=electron-builder - matrix: - - TEST=lint-ci - - TEST=test-ci + +os: + - linux + - osx node_js: - node - - 8 + - lts/* cache: apt: true @@ -24,14 +25,14 @@ cache: addons: apt: packages: - - icnsutils - - graphicsmagick - - xz-utils - - xorriso + - xvfb install: - yarn - - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16" + - | + if [ $TRAVIS_OS_NAME == "linux" ]; then + /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16 + fi before_script: - export DISPLAY=:99.0 @@ -39,4 +40,31 @@ before_script: - sleep 3 script: - - "travis_wait 30 yarn $TEST" + - yarn lint-ci || travis_terminate 1 + - yarn build || travis_terminate 1 + - yarn test-ci || travis_terminate 1 + - yarn coveralls || travis_terminate 1 + +jobs: + include: + - stage: deploy + name: Deploy to Github + script: skip + deploy: + skip_cleanup: true + provider: script + script: yarn release + on: + repo: LN-Zap/zap-desktop + branch: master + + - os: osx + name: Deploy to Github + script: skip + deploy: + skip_cleanup: true + provider: script + script: yarn release + on: + repo: LN-Zap/zap-desktop + branch: master diff --git a/appveyor.yml b/appveyor.yml index a7d7f9ad..61a38d6b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,13 +1,17 @@ os: unstable environment: + DEBUG: electron-builder matrix: - - nodejs_version: 10 - - nodejs_version: 8 + - nodejs_version: STABLE + publish_build: true + - nodejs_version: LTS cache: + - '%APPDATA%\npm-cache' - "%LOCALAPPDATA%/Yarn" - node_modules -> package.json + - flow-typed - app/node_modules -> app/package.json matrix: @@ -27,8 +31,9 @@ install: - yarn test_script: - - node --version - - yarn lint - - yarn package - - yarn test - - yarn test-e2e + - yarn lint-ci + - yarn build + - yarn test-ci + +deploy_script: + - cmd: powershell if (($env:appveyor_repo_name -eq 'LN-Zap/zap-desktop') -and ($env:appveyor_repo_branch -eq 'master') -and ($env:publish_build)) { yarn release } diff --git a/package.json b/package.json index 0417115f..78ba3704 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,8 @@ "build-renderer": "webpack --require babel-register --config webpack.config.renderer.prod.js --progress", "build-grpc": "rimraf app/node_modules/grpc/src/node && build install-app-deps", "clean": "rimraf node_modules app/node_modules dll app/dist", + "coverage": "open coverage/index.html", + "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", "dev": "cross-env START_HOT=1 npm run start-renderer-dev", "fetch-lnd": "node ./internals/scripts/fetch-lnd-for-packaging.js", "flow": "flow", @@ -23,23 +25,18 @@ "lint-styles-fix-base": "npm run lint-styles-base -- --fix", "lint-styles-fix": "npm run lint-styles-fix-base -- $npm_package_config_style_paths", "lint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check", - "lint-ci": "npm run lint && npm run lint-styles && npm run flow", - "package": "npm run build && rimraf app/node_modules/grpc/src/node && npm run fetch-lnd && build --publish never", - "package-mac": "npm run package -- --platform mac --arch all && npm run build-grpc", - "package-win": "npm run package -- --platform win --arch all && npm run build-grpc", - "package-linux": "npm_config_target_libc=glibc npm run package -- --platform linux --arch all && npm run build-grpc", - "package-all": "npm run package-mac && npm run package-win && npm run package-linux", + "lint-ci": "npm run lint && npm run lint-styles", + "package": "npm run build && npm run fetch-lnd && build", + "release": "npm run package -- --publish onTagOrDraft", "postinstall": "concurrently --raw \"npm:flow-typed\" \"npm:build-dll\" \"build install-app-deps\" \"node node_modules/fbjs-scripts/node/check-dev-engines.js package.json\"", "prestart": "npm run build", "start": "cross-env NODE_ENV=production electron ./app/", "start-main-dev": "cross-env HOT=1 NODE_ENV=development electron -r babel-register ./app/main.dev", "start-renderer-dev": "node --trace-warnings -r babel-register ./node_modules/webpack-serve/lib/cli.js --config webpack.config.renderer.dev.js", "test": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 node --trace-warnings ./test/runTests.js", - "test-ci": "npm run package && npm run test-e2e && npm run test && npm run coveralls", - "test-all": "npm run lint && npm run lint-styles && npm run flow && npm run build && npm run test-e2e && npm run test", - "test-e2e": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 node --trace-warnings ./test/runTests.js e2e", - "coverage": "open coverage/index.html", - "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" + "test-ci": "npm run test && npm run test-e2e", + "test-all": "npm run lint && npm run lint-styles && npm run flow && npm run build && npm run test && npm run test-e2e", + "test-e2e": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 node --trace-warnings ./test/runTests.js e2e" }, "config": { "style_paths": "app/styles/*.scss app/components/**/*.scss", @@ -58,8 +55,9 @@ "yarn": ">=0.21.3" }, "build": { - "productName": "Zap", + "productName": "ZapDesktop", "appId": "org.develar.ZapDesktop", + "generateUpdatesFilesForAllChannels": true, "files": [ "dist/", "node_modules/", @@ -67,8 +65,31 @@ "main.prod.js.map", "package.json" ], + "directories": { + "buildResources": "resources", + "output": "release" + }, + "extraResources": [ + "resources/lnd.conf", + "resources/rpc.proto", + { + "from": "resources/bin/${os}/${arch}", + "to": "bin", + "filter": [ + "lnd*" + ] + } + ], + "artifactName": "${productName}-${platform}-${arch}-v${version}.${ext}", + "mac": { + "category": "public.app-category.finance", + "icon": "resources/icons/icon.icns", + "target": [ + "dmg", + "zip" + ] + }, "dmg": { - "icon": "./resources/icon.icns", "contents": [ { "x": 130, @@ -83,33 +104,37 @@ ] }, "win": { - "icon": "./resources/icon.ico", + "icon": "resources/icons/icon.ico", "target": [ - "nsis" + { + "target": "nsis", + "arch": [ + "x64", + "ia32" + ] + } ] }, "linux": { - "category": "Utility", + "category": "Finance", + "icon": "resources/icons/icon.png", "target": [ - "deb", - "AppImage" + { + "target": "deb", + "arch": [ + "x64", + "ia32" + ] + }, + { + "target": "AppImage", + "arch": [ + "x64", + "ia32" + ] + } ] - }, - "directories": { - "buildResources": "resources", - "output": "release" - }, - "extraResources": [ - "resources/lnd.conf", - "resources/rpc.proto", - { - "from": "resources/bin/${os}/${arch}", - "to": "bin", - "filter": [ - "lnd*" - ] - } - ] + } }, "repository": { "type": "git", diff --git a/resources/icon.icns b/resources/icons/icon.icns similarity index 100% rename from resources/icon.icns rename to resources/icons/icon.icns diff --git a/resources/icon.ico b/resources/icons/icon.ico similarity index 100% rename from resources/icon.ico rename to resources/icons/icon.ico diff --git a/resources/icon.png b/resources/icons/icon.png similarity index 100% rename from resources/icon.png rename to resources/icons/icon.png