forked from tailwarden/komiser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
100 lines (97 loc) · 3.28 KB
/
circle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
version: 2
jobs:
build_frontend:
docker:
- image: circleci/node:8.10-stretch-browsers
working_directory: ~/komiser
steps:
- checkout
- restore_cache:
key: node-modules-{{checksum "public/package.json"}}
- run:
name: Install dependencies
command: cd public && npm install
- save_cache:
key: node-modules-{{checksum "public/package.json"}}
paths:
- public/node_modules
- run:
name: Build artifact
command: cd public && npm run build
- persist_to_workspace:
root: public
paths:
- dist
build_cli:
docker:
- image: golang:1.8
working_directory: /go/src/github.com/mlabouardy/komiser
steps:
- checkout
- attach_workspace:
at: /tmp/public
- run:
name: Install dependencies
command: go get -v
- run:
name: Install go-bin-data
command: |
go get github.com/jteeuwen/go-bindata/...
go get github.com/elazarl/go-bindata-assetfs/...
- run:
name: Fix path
command: mv /tmp/public/dist .
- run:
name: Create assets
command: go-bindata-assetfs -o template.go dist/ dist/assets/images/
- run:
name: Install gox
command: go get github.com/mitchellh/gox
- run:
name: Build binary
command: gox -osarch="linux/amd64 windows/amd64 darwin/amd64"
- run:
name: Install AWS CLI
command: |
apt-get update
apt-get install -y awscli
chmod +x komiser_windows_amd64.exe komiser_darwin_amd64 komiser_linux_amd64
- run:
name: Push Linux binary
command: aws s3 cp komiser_linux_amd64 s3://komiser/1.0.0/linux/komiser --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
- run:
name: Push Windows binary
command: aws s3 cp komiser_windows_amd64.exe s3://komiser/1.0.0/windows/komiser --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
- run:
name: Push Mac OS X binary
command: aws s3 cp komiser_darwin_amd64 s3://komiser/1.0.0/osx/komiser --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
- run:
name: Upload IAM policy
command: aws s3 cp policy.json s3://komiser/policy.json --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
build_docker:
docker:
- image: docker:18.02.0-ce
steps:
- checkout
- setup_remote_docker
- run:
name: Build Komiser Docker Image
command: docker build -t mlabouardy/komiser:latest .
- deploy:
name: Push Komiser to DockerHub
command: |
docker login -u$DOCKERHUB_LOGIN -p$DOCKERHUB_PASSWORD
docker tag mlabouardy/komiser:latest mlabouardy/komiser:${CIRCLE_SHA1}
docker push mlabouardy/komiser:latest
docker push mlabouardy/komiser:${CIRCLE_SHA1}
workflows:
version: 2
build_and_deploy:
jobs:
- build_frontend
- build_cli:
requires:
- build_frontend
- build_docker:
requires:
- build_cli