From 3b3b23142c7dc14efc40a9bb2db1def019356786 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Fri, 11 Nov 2016 11:17:38 +0900 Subject: [PATCH] chore(build-system): add a release for macos task (#342) --- build.sh | 6 ++++++ gruntFile.js | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/build.sh b/build.sh index 55d88ceed..f005be328 100755 --- a/build.sh +++ b/build.sh @@ -25,4 +25,10 @@ mv dist/* /tmp/portainer-build-arm/portainer cd /tmp/portainer-build-arm tar cvpfz portainer-${VERSION}-linux-arm.tar.gz portainer +grunt release-macos +rm -rf /tmp/portainer-build-darwin && mkdir -pv /tmp/portainer-build-darwin/portainer +mv dist/* /tmp/portainer-build-darwin/portainer +cd /tmp/portainer-build-darwin +tar cvpfz portainer-${VERSION}-darwin-amd64.tar.gz portainer + exit 0 diff --git a/gruntFile.js b/gruntFile.js index 635d9adfb..143f49ea2 100644 --- a/gruntFile.js +++ b/gruntFile.js @@ -59,6 +59,18 @@ module.exports = function (grunt) { 'recess:min', 'copy' ]); + grunt.registerTask('release-macos', [ + 'clean:all', + 'if:darwinBinaryNotExist', + 'html2js', + 'uglify', + 'clean:tmpl', + 'jshint', + //'karma:unit', + 'concat:index', + 'recess:min', + 'copy' + ]); grunt.registerTask('lint', ['jshint']); grunt.registerTask('test-watch', ['karma:watch']); grunt.registerTask('run', ['if:unixBinaryNotExist', 'build', 'shell:buildImage', 'shell:run']); @@ -296,6 +308,14 @@ module.exports = function (grunt) { 'mv api/portainer-linux-arm dist/portainer' ].join(' && ') }, + buildDarwinBinary: { + command: [ + 'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="darwin" -e BUILD_GOARCH="amd64" centurylink/golang-builder-cross', + 'shasum api/portainer-darwin-amd64 > portainer-checksum.txt', + 'mkdir -p dist', + 'mv api/portainer-darwin-amd64 dist/portainer' + ].join(' && ') + }, buildWindowsBinary: { command: [ 'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="windows" -e BUILD_GOARCH="amd64" centurylink/golang-builder-cross', @@ -349,6 +369,12 @@ module.exports = function (grunt) { }, ifFalse: ['shell:buildUnixArmBinary'] }, + darwinBinaryNotExist: { + options: { + executable: 'dist/portainer' + }, + ifFalse: ['shell:buildDarwinBinary'] + }, windowsBinaryNotExist: { options: { executable: 'dist/portainer.exe'