-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathangular.yaml
169 lines (168 loc) · 6.67 KB
/
angular.yaml
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
version: 2.1
description: |
Help to deploy angular projects
display:
home_url: https://github.com/donkeycode/circle-orbs
source_url: https://github.com/donkeycode/circle-orbs
orbs:
docker: donkeycode/[email protected]
utils: donkeycode/[email protected]
commands:
get_workspace:
description: |
Get workspace content
parameters:
angular_folder:
default: apps/front
description: The angular base directory
type: string
steps:
- attach_workspace:
at: /tmp/workspace
- run:
command: |-
cp -R /tmp/workspace/<<parameters.angular_folder>>/dist ~/project/<<parameters.angular_folder>>/dist
cp -R /tmp/workspace/<<parameters.angular_folder>>/dist-circle ~/project/<<parameters.angular_folder>>/dist-circle
name: copy dist
executors:
default:
description: |
Nodejs executor
docker:
- image: node:<<parameters.image_tag>>
parameters:
image_tag:
default: lts-alpine
description: |
Pick a specific donkeycode/php-nginx-symfony image variant: https://hub.docker.com/_/node?tab=tags
type: string
jobs:
build:
description: |
Prepare angular project
executor: docker/default
parameters:
angular_folder:
default: apps/front
description: The angular base directory
type: string
dependencies_version:
default: v1
description: The deps version to force uncaching
type: string
dockerfile_base_name:
default: Dockerfile-front
description: The docker base name eg Dockerfile-front
type: string
image_base_name:
description: The docker base name eg project/front
type: string
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- get_workspace:
angular_folder: <<parameters.angular_folder>>
- restore_cache:
keys:
- <<parameters.dependencies_version>>-dependencies-<<parameters.angular_folder>>-{{ checksum "<<parameters.angular_folder>>/package-lock.json" }}
- <<parameters.dependencies_version>>-dependencies-<<parameters.angular_folder>>-
- docker/ecr_login
- run:
command: |
source ~/project/.circleci/determine_env.sh
docker build -t ${ECR_BASE}/<<parameters.image_base_name>>:$CIRCLE_SHA1 -f ~/project/docker/<<parameters.dockerfile_base_name>> .
docker push ${ECR_BASE}/<<parameters.image_base_name>>:$CIRCLE_SHA1
name: Build app
working_directory: ~/project
prepare:
description: |
Prepare angular project
executor: default
parameters:
angular_folder:
default: apps/front
description: The angular base directory
type: string
dependencies_version:
default: v1
description: The deps version to force uncaching
type: string
image_tag:
default: lts-alpine
description: |
Pick a specific donkeycode/php-nginx-symfony image variant: https://hub.docker.com/_/node?tab=tags
type: string
use_lint:
default: true
description: |
Does the project need to use lint ?
type: boolean
use_prettier:
default: true
description: |
Does the project need to use prettier-check ?
type: boolean
steps:
- checkout
- utils/install_git
- restore_cache:
keys:
- <<parameters.dependencies_version>>-dependencies-<<parameters.angular_folder>>-{{ checksum "<<parameters.angular_folder>>/package-lock.json" }}
- <<parameters.dependencies_version>>-dependencies-<<parameters.angular_folder>>-
- run:
command: npm install
name: Install node deps
working_directory: ~/project/<<parameters.angular_folder>>
- save_cache:
key: <<parameters.dependencies_version>>-dependencies-<<parameters.angular_folder>>-{{ checksum "<<parameters.angular_folder>>/package-lock.json" }}
paths:
- <<parameters.angular_folder>>/node_modules
- when:
condition: <<parameters.use_lint>>
steps:
- run:
command: |
source ~/project/.circleci/determine_env.sh
npm run lint
name: Lint angular
working_directory: ~/project/<<parameters.angular_folder>>
- when:
condition: <<parameters.use_prettier>>
steps:
- run:
command: |
source ~/project/.circleci/determine_env.sh
npm run prettier-check
name: Prettier angular
working_directory: ~/project/<<parameters.angular_folder>>
- run:
command: |
source ~/project/.circleci/determine_env.sh
npm run build:circle
mv dist dist-circle
name: Build angular for CIRCLE
working_directory: ~/project/<<parameters.angular_folder>>
- run:
command: |
source ~/project/.circleci/determine_env.sh
npm run build:${BUILD_ENV}
name: Build angular for BUILD_ENV
working_directory: ~/project/<<parameters.angular_folder>>
- persist_to_workspace:
paths:
- <<parameters.angular_folder>>/dist
- <<parameters.angular_folder>>/dist-circle
root: ~/project
examples:
example:
description: |
Sample example description.
usage:
version: "2.1"
orbs:
angular: donkeycode/[email protected]
workflows:
use-my-orb:
jobs:
- angular/prepare