Merge branch 'simplify-packaging'

This commit is contained in:
Yuya Ochiai
2015-12-12 15:14:39 +09:00
6 changed files with 92 additions and 8 deletions

View File

@@ -52,8 +52,9 @@ $ npm install -g gulp (Or, use node_module/gulp/bin/gulp.js
You can package this app with following commands. Packages will be created in `release` directory.
```
$ gulp package (for your platform)
$ gulp package:windows (Requires Windows or Wine)
$ gulp package:osx (Requires OS X or Linux)
$ gulp package:linux
$ gulp package (Packages for all platform)
$ gulp package:all (Packages for all platform)
```

View File

@@ -1,14 +1,23 @@
dependencies:
cache_directories:
- ~/.electron
post:
- gulp package:osx
- sudo service docker start
- docker build -t $CIRCLE_USERNAME/em-builder docker
- docker run --rm -it -v `pwd`:/home/xclient/electron-mattermost $CIRCLE_USERNAME/em-builder ./electron-mattermost/docker/package_in_docker.sh
- mv release/electron-mattermost-win32-ia32 release/electron-mattermost-win32
- mv release/electron-mattermost-win32-x64 release/electron-mattermost-win64
- mv release/electron-mattermost-darwin-x64 release/electron-mattermost-osx
- tar zcvf /$CIRCLE_ARTIFACTS/electron-mattermost-osx.tar.gz -C release electron-mattermost-osx
- gulp package:linux
- tar zcvf /$CIRCLE_ARTIFACTS/electron-mattermost-linux-ia32.tar.gz -C release electron-mattermost-linux-ia32
- tar zcvf /$CIRCLE_ARTIFACTS/electron-mattermost-linux-x64.tar.gz -C release electron-mattermost-linux-x64
- cd release && zip -9 -r $CIRCLE_ARTIFACTS/electron-mattermost-win32.zip electron-mattermost-win32
- cd release && zip -9 -r $CIRCLE_ARTIFACTS/electron-mattermost-win64.zip electron-mattermost-win64
- tar zcvf $CIRCLE_ARTIFACTS/electron-mattermost-osx.tar.gz -C release electron-mattermost-osx
- tar zcvf $CIRCLE_ARTIFACTS/electron-mattermost-linux-ia32.tar.gz -C release electron-mattermost-linux-ia32
- tar zcvf $CIRCLE_ARTIFACTS/electron-mattermost-linux-x64.tar.gz -C release electron-mattermost-linux-x64
test:
override:
- exit 0
deployment:
release:
tag: /v[0-9]+(\.[0-9]+)*/
commands:
- ./circle/make_draft.sh

53
circle/make_draft.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/bin/sh
set -ex
wget -q https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2
tar jxvf linux-amd64-github-release.tar.bz2
GITHUB_RELEASE=`pwd`/bin/linux/amd64/github-release
upload()
{
NAME=$1
FILE=$2
$GITHUB_RELEASE upload --user $CIRCLE_PROJECT_USERNAME --repo $CIRCLE_PROJECT_REPONAME --tag $CIRCLE_TAG --name \"$NAME\" --file $FILE
}
make_zip()
{
OLDDIR=`pwd`
ARCH=$1
cp -r release/electron-mattermost-$ARCH /tmp/electron-mattermost-$CIRCLE_TAG-$ARCH
cd /tmp
zip -9 -r electron-mattermost-$CIRCLE_TAG-$ARCH.zip electron-mattermost-$CIRCLE_TAG-$ARCH
cd $OLDDIR
}
make_tar_gz()
{
OLDDIR=`pwd`
ARCH=$1
cp -r release/electron-mattermost-$ARCH /tmp/electron-mattermost-$CIRCLE_TAG-$ARCH
cd /tmp
tar zcvf electron-mattermost-$CIRCLE_TAG-$ARCH.tar.gz electron-mattermost-$CIRCLE_TAG-$ARCH
cd $OLDDIR
}
deploy()
{
ARCH=$1
ARCHIVE_FORMAT=$2
case "$ARCHIVE_FORMAT" in
"zip" ) make_zip $ARCH ;;
"tar.gz" ) make_tar_gz $ARCH ;;
"*" ) echo "Invalid ARCHIVE_FORMAT: $ARCHIVE_FORMAT" && exit 1 ;;
esac
FILE=electron-mattermost-$CIRCLE_TAG-$ARCH.$ARCHIVE_FORMAT
upload "$FILE" /tmp/$FILE
}
$GITHUB_RELEASE release --user $CIRCLE_PROJECT_USERNAME --repo $CIRCLE_PROJECT_REPONAME --tag $CIRCLE_TAG --draft
deploy win32 zip
deploy win64 zip
deploy osx tar.gz
deploy linux-ia32 tar.gz
deploy linux-x64 tar.gz

12
docker/Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM suchja/wine:latest
MAINTAINER Yuya Ochiai <yuya0321@gmail.com>
ENV NODE_VERSION=v4.2.3
ENV PATH=$HOME/.nodebrew/current/bin:$PATH
USER root
RUN apt-get update && apt-get -y install wget bzip2 zip
USER xclient
# install Node.js
RUN curl -L git.io/nodebrew | perl - setup && nodebrew install-binary $NODE_VERSION && nodebrew use $NODE_VERSION

5
docker/package_in_docker.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
# This script should be executed in docker container.
set -ex
cd electron-mattermost
./node_modules/gulp/bin/gulp.js package:all

View File

@@ -68,6 +68,10 @@ function makePackage(platform, arch) {
};
gulp.task('package', ['sync-meta'], function() {
makePackage(process.platform, 'all');
});
gulp.task('package:all', ['sync-meta'], function() {
makePackage('all', 'all');
});