This commit is contained in:
deepzz0
2016-12-25 01:24:34 +08:00
parent c063061482
commit 03282123d4
3 changed files with 29 additions and 16 deletions
+16 -6
View File
@@ -1,29 +1,33 @@
sudo: required # 超级权限 sudo: required # 超级权限
dist: trusty # 在ubuntu:trusty dist: trusty # 在ubuntu:trusty
notifications: # 每次构建的时候是否通知,如果不想收到通知邮箱(个人感觉邮件贼烦),那就设置false吧 notifications: # 每次构建的时候是否通知,如果不想收到通知邮箱(个人感觉邮件贼烦),那就设置false吧
email: false email: false
language: go # 声明构建语言环境 language: go # 声明构建语言环境
go: # 只构建最新版本 go: # 只构建最新版本
- tip - tip
services: # docker环境 services: # docker环境
- docker - docker
branches: # 限定项目分支 branches: # 限定项目分支
only: only:
- master - master
before_install: before_install:
- curl https://glide.sh/get | sh # 安装glide包管理 - curl https://glide.sh/get | sh # 安装glide包管理
script: script:
- glide up - glide up
- GOOS=linux GOARCH=amd64 go build # 编译版本 - GOOS=linux GOARCH=amd64 go build # 编译版本
- docker build -t registry.cn-hangzhou.aliyuncs.com/deepzz/eiblog . # 构建镜像 - docker build -t registry.cn-hangzhou.aliyuncs.com/deepzz/eiblog . # 构建镜像
after_success:
- if [ "$TRAVIS_BRANCH" == "master" ]; then
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" registry.cn-hangzhou.aliyuncs.com;
docker push registry.cn-hangzhou.aliyuncs.com/deepzz/eiblog;
fi # push到镜像仓库
before_deploy: before_deploy:
- ./before_deploy.sh - ./dist.sh
deploy: deploy:
provider: releases provider: releases
api_key: api_key:
@@ -35,3 +39,9 @@ deploy:
tags: true tags: true
repo: eiblog/eiblog repo: eiblog/eiblog
all_branches: true all_branches: true
after_success:
- if [ "$TRAVIS_BRANCH" == "master" ]; then
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" registry.cn-hangzhou.aliyuncs.com;
docker push registry.cn-hangzhou.aliyuncs.com/deepzz/eiblog;
fi
-10
View File
@@ -1,10 +0,0 @@
#!/bin/bash
VERSION=`git describe --tags`
tar zcvf eiblog-$VERSION-linux-amd64.tar.gz conf static views eiblog
GOOS=windows GOARCH=amd64 go build && \
tar zcvf eiblog-$VERSION-windows-amd64.tar.gz conf static views eiblog
GOOS=darwin GOARCH=amd64 go build && \
tar zcvf eiblog-$VERSION-darwin-amd64.tar.gz conf static views eiblog
Executable
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# GOFLAGS='-ldflags="-s -w"'
version=`git describe --tags`
arch=$(go env GOARCH)
for os in linux darwin windows; do
echo "... building $version for $os/$arch"
TARGET="eiblog-$version.$os-$arch"
GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build
tar czvf $TARGET.tar.gz conf static views eiblog
rm eiblog
done