Skip to content

Commit 7aaedfb

Browse files
committed
Add circleci job for docker
1 parent 827f555 commit 7aaedfb

File tree

2 files changed

+65
-41
lines changed

2 files changed

+65
-41
lines changed

.circleci/config.yml

Lines changed: 62 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,77 @@ version: 2
22
jobs:
33
app:
44
docker:
5-
- image: circleci/golang:1.16
5+
- image: circleci/golang:1.16
66

77
working_directory: /go/src/github.com/RoboCup-SSL/ssl-simulation-controller
88
steps:
9-
- checkout
10-
- run: go get -v -t -d ./...
11-
- run: go test -v ./...
12-
- run:
13-
working_directory: cmd/ssl-simulation-controller
14-
command: |
15-
GOOS=linux GOARCH=amd64 go build -o ../../release/ssl-simulation-controller_linux_amd64
16-
GOOS=darwin GOARCH=amd64 go build -o ../../release/ssl-simulation-controller_darwin_amd64
17-
GOOS=windows GOARCH=amd64 go build -o ../../release/ssl-simulation-controller_windows_amd64.exe
18-
- persist_to_workspace:
19-
root: .
20-
paths:
21-
- release/*
9+
- checkout
10+
- run: go get -v -t -d ./...
11+
- run: go test -v ./...
12+
- run:
13+
working_directory: cmd/ssl-simulation-controller
14+
command: |
15+
GOOS=linux GOARCH=amd64 go build -o ../../release/ssl-simulation-controller_linux_amd64
16+
GOOS=darwin GOARCH=amd64 go build -o ../../release/ssl-simulation-controller_darwin_amd64
17+
GOOS=windows GOARCH=amd64 go build -o ../../release/ssl-simulation-controller_windows_amd64.exe
18+
- persist_to_workspace:
19+
root: .
20+
paths:
21+
- release/*
2222

2323
publish-github-release:
2424
docker:
25-
- image: circleci/golang:1.16
25+
- image: circleci/golang:1.16
2626
steps:
27-
- attach_workspace:
28-
at: .
29-
- run:
30-
name: "Prepare artifacts"
31-
working_directory: release
32-
command: |
33-
mv ssl-simulation-controller_linux_amd64 ssl-simulation-controller_${CIRCLE_TAG}_linux_amd64
34-
mv ssl-simulation-controller_darwin_amd64 ssl-simulation-controller_${CIRCLE_TAG}_darwin_amd64
35-
mv ssl-simulation-controller_windows_amd64.exe ssl-simulation-controller_${CIRCLE_TAG}_windows_amd64.exe
36-
- run:
37-
name: "Publish Release on GitHub"
38-
command: |
39-
go get github.com/tcnksm/ghr
40-
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./release/
27+
- attach_workspace:
28+
at: .
29+
- run:
30+
name: "Prepare artifacts"
31+
working_directory: release
32+
command: |
33+
mv ssl-simulation-controller_linux_amd64 ssl-simulation-controller_${CIRCLE_TAG}_linux_amd64
34+
mv ssl-simulation-controller_darwin_amd64 ssl-simulation-controller_${CIRCLE_TAG}_darwin_amd64
35+
mv ssl-simulation-controller_windows_amd64.exe ssl-simulation-controller_${CIRCLE_TAG}_windows_amd64.exe
36+
- run:
37+
name: "Publish Release on GitHub"
38+
command: |
39+
go get github.com/tcnksm/ghr
40+
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./release/
41+
42+
docker:
43+
docker:
44+
- image: cimg/base:2021.04
45+
steps:
46+
- checkout
47+
- setup_remote_docker:
48+
version: 20.10.6
49+
- run: |
50+
TAG=${CIRCLE_TAG:-latest}
51+
docker build -t robocupssl/ssl-simulation-controller:$TAG .
52+
docker login -u "${DOCKER_HUB_USERNAME}" -p "${DOCKER_HUB_PASSWORD}"
53+
docker push robocupssl/ssl-simulation-controller:$TAG
4154
4255
workflows:
4356
version: 2
4457
main:
4558
jobs:
46-
- app:
47-
filters:
48-
tags:
49-
only: /.*/
50-
- publish-github-release:
51-
requires:
52-
- app
53-
filters:
54-
branches:
55-
ignore: /.*/
56-
tags:
57-
only: /^v.*/
59+
- app:
60+
filters:
61+
tags:
62+
only: /.*/
63+
- publish-github-release:
64+
requires:
65+
- app
66+
filters:
67+
branches:
68+
ignore: /.*/
69+
tags:
70+
only: /^v.*/
71+
- docker:
72+
context: docker hub
73+
filters:
74+
branches:
75+
only: master
76+
tags:
77+
only: /^v.*/
78+

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ insert_final_newline = true
99
indent_style = space
1010
indent_size = 4
1111

12+
[{*.yaml, *.yml}]
13+
indent_size = 2
14+
1215
[*.go]
1316
indent_style = tab

0 commit comments

Comments
 (0)