Skip to content

Commit

Permalink
Refactor CircleCI config (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepankuzmin authored Dec 16, 2022
1 parent 3a35b0b commit e3bd252
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: 2.1
orbs:
aws-cli: circleci/aws-cli@3.1.4
browser-tools: circleci/browser-tools@1.4.0

workflows:
version: 2
default:
Expand Down Expand Up @@ -39,19 +40,21 @@ workflows:
- publish:
requires:
- build
- install-mbx-ci
filters:
tags:
only: '/v[0-9]+\.[0-9]+\.[0-9]+(\-dev)?/'
branches:
ignore: /.*/
defaults:
docker: &ref_0
- image: 'cimg/node:18.12-browsers'

defaults: &defaults
docker:
- image: cimg/node:18.12-browsers
working_directory: ~/mapbox-gl-directions

jobs:
prepare:
docker: *ref_0
working_directory: ~/mapbox-gl-directions
<<: *defaults
steps:
- checkout
- restore_cache:
Expand All @@ -62,12 +65,13 @@ jobs:
paths:
- node_modules
- persist_to_workspace:
root: .
root: ~/
paths:
- .
- .ssh
- mapbox-gl-directions

install-mbx-ci:
docker: *ref_0
working_directory: ~/mapbox-gl-directions
<<: *defaults
steps:
- run:
name: Install mbx-ci
Expand All @@ -80,25 +84,25 @@ jobs:
- .ssh
- .aws
- mbx-ci

build:
docker: *ref_0
working_directory: ~/mapbox-gl-directions
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- run: npm run build
- store_artifacts:
path: dist
- persist_to_workspace:
root: .
root: ~/
paths:
- dist
- mapbox-gl-directions/dist

lint:
docker: *ref_0
working_directory: ~/mapbox-gl-directions
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- restore_cache:
keys:
- 'v2-lint-{{ .Branch }}'
Expand All @@ -108,25 +112,24 @@ jobs:
key: 'v2-lint-{{ .Branch }}-{{ .Revision }}'
paths:
- .eslintcache

test:
docker: *ref_0
working_directory: ~/mapbox-gl-directions
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- browser-tools/install-firefox
- run: npm run test

publish:
docker: *ref_0
working_directory: ~/mapbox-gl-directions
<<: *defaults
steps:
- attach_workspace:
at: .
at: ~/
- aws-cli/install
- run:
name: Setup AWS
command: |
~/mbx-ci aws setup
- run: >-
aws s3 cp --recursive --acl public-read dist
s3://mapbox-gl-js/plugins/mapbox-gl-directions/$CIRCLE_TAG
aws s3 cp --recursive --acl public-read dist s3://mapbox-gl-js/plugins/mapbox-gl-directions/$CIRCLE_TAG

0 comments on commit e3bd252

Please sign in to comment.