Skip to content

Commit

Permalink
Refactor build and release logic by using workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
chetanyakan committed Dec 19, 2018
1 parent ae10035 commit 5d77f42
Showing 1 changed file with 17 additions and 26 deletions.
43 changes: 17 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,37 +36,20 @@ jobs:
- store_artifacts:
path: ./dist
destination: build
- persist_to_workspace:
root: .
paths:
- dist

build-and-release:
release:
docker:
- image: circleci/golang:1.11-node
working_directory: /go/src/github.com/Brightscout/mattermost-plugin-boilerplate
steps:
- checkout
- restore_cache:
name: Restore Golang dependencies cache
key: dependency-cache-{{ checksum "./server/glide.lock" }}
- restore_cache:
name: Restore NPM dependencies cache
key: dependency-cache-{{ checksum "./webapp/package-lock.json" }}
- type: shell
name: 'Build artifacts'
command: make dist
environment:
TERM: dumb
- run:
name: Test
command: make test
- save_cache:
name: Save Golang dependencies cache
key: dependency-cache-{{ checksum "./server/glide.lock" }}
paths:
- ./server/vendor
- save_cache:
name: Save NPM dependencies cache
key: dependency-cache-{{ checksum "./webapp/package-lock.json" }}
paths:
- ./webapp/node_modules
- attach_workspace:
at: .
- run: ls *
- run: go get -u github.com/tcnksm/ghr
- run: ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace `git describe --tags` dist/

Expand All @@ -82,7 +65,15 @@ workflows:
ignore: /.*/
build-and-release:
jobs:
- build-and-release:
- build:
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- release:
requires:
- build
filters:
branches:
ignore: /.*/
Expand Down

0 comments on commit 5d77f42

Please sign in to comment.