@@ -67,15 +67,15 @@ references:
6767 - packages
6868
6969 restore_node_modules : &restore_node_modules
70- attach_workspace :
70+ attach_workspace : # The attach_workspace copies and re-creates the entire workspace content when it runs.
7171 at : ~/repo
7272
7373 build_all_packages : &build_all_packages
7474 run :
7575 name : Build All Packages
7676 command : yarn build
7777
78- set_git_user : &set_git_user
78+ set_git_user : &set_git_user # move to yarn action maybe
7979 run :
8080 name : Set git user
8181 command : |
@@ -111,35 +111,13 @@ jobs:
111111 checkout_code :
112112 << : *default_env
113113 steps :
114- - checkout
114+ - checkout # circle keyword
115115 - *set_npm_token
116116 - *restore_yarn_cache
117117 - run : yarn --production=false --frozen-lockfile
118118 - *save_yarn_cache
119119 - *save_node_modules
120120
121- tests :
122- << : *default_env
123- resource_class : large
124- steps :
125- - checkout
126- - *restore_node_modules
127- - *restore_nx_cache
128- - *build_all_packages
129- - run :
130- name : Run test suite
131- command : |
132- yarn test --parallel=4 --ci --coverage -- --runInBand
133- environment :
134- JEST_JUNIT_OUTPUT_DIR : /tmp/test-results/junit
135- JEST_JUNIT_ADD_FILE_ATTRIBUTE : ' true'
136- - *save_nx_cache
137- - store_test_results :
138- path : /tmp/test-results
139- - store_artifacts :
140- path : /tmp/test-results
141- destination : test-results
142-
143121 publish :
144122 << : *default_env
145123 resource_class : large
@@ -176,92 +154,6 @@ jobs:
176154 - *save_nx_cache
177155 - *save_webpack_cache
178156
179- deploy_alpha :
180- << : *default_env
181- resource_class : large
182- steps :
183- - *skip_if_not_pr
184- - *skip_on_automated_commit
185- - *set_git_user
186- - checkout
187- - *restore_node_modules
188- - *restore_nx_cache
189- - *restore_webpack_cache
190- - *build_all_packages
191- - run :
192- name : build storybook
193- command : yarn nx run styleguide:build-storybook
194- - *save_nx_cache
195- - *save_webpack_cache
196- - run :
197- name : deploy
198- command : |
199- DEPLOY_MESSAGE="User: ${CIRCLE_USERNAME} Project: ${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME} Pull Request: ${CIRCLE_PULL_REQUEST}"
200- npx [email protected] deploy --message "${DEPLOY_MESSAGE}" --dir dist/storybook/styleguide --json --filter @codecademy/styleguide > .deploy-output 201- - setup_remote_docker
202- - run : docker pull cloudposse/github-commenter:0.5.0-58
203- - run :
204- name : comment
205- command : |
206- export DEPLOY_OUTPUT="$(cat .deploy-output)"
207- echo $DEPLOY_OUTPUT
208- DEPLOY_URL=$(echo "console.log(JSON.parse(process.env.DEPLOY_OUTPUT).deploy_url)" | node -)
209- LOGS_URL=$(echo "console.log(JSON.parse(process.env.DEPLOY_OUTPUT).logs)" | node -)
210- COMMENT_MSG="<p><a href="${DEPLOY_URL}">${DEPLOY_URL}</a></p><p><a href="${LOGS_URL}">Deploy Logs</a></p>"
211- if [ -z "$DEPLOY_OUTPUT" ]
212- then
213- echo "No deploy output found, will not add PR comment"
214- else
215- docker run --rm \
216- -e GITHUB_TOKEN \
217- -e GITHUB_OWNER="${CIRCLE_PROJECT_USERNAME}" \
218- -e GITHUB_REPO="${CIRCLE_PROJECT_REPONAME}" \
219- -e GITHUB_COMMENT_TYPE=pr \
220- -e GITHUB_PR_ISSUE_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}" \
221- -e GITHUB_COMMENT_TEMPLATE='<p>🚀 Styleguide deploy preview ready!</p>{{.}}<!--ALPHA_DEPLOY_COMMENT-->' \
222- -e GITHUB_DELETE_COMMENT_REGEX="ALPHA_DEPLOY_COMMENT" \
223- -e GITHUB_COMMENT="${COMMENT_MSG}" \
224- cloudposse/github-commenter:0.5.0-58
225- fi
226-
227- publish_alpha :
228- << : *default_env
229- resource_class : large
230- steps :
231- - *skip_if_not_pr
232- - *skip_on_automated_commit
233- - *set_git_user
234- - checkout
235- - *restore_node_modules
236- - *set_npm_token
237- - *restore_nx_cache
238- - *build_all_packages
239- - *save_nx_cache
240- - run :
241- name : lerna publish (alpha)
242- command : yarn lerna publish --exact --yes --include-merged-tags --no-push --no-git-reset --conventional-commits --conventional-prerelease --preid=alpha.${CIRCLE_SHA1:0:6} --dist-tag=alpha.${CIRCLE_SHA1:0:6}
243- - setup_remote_docker
244- - run : docker pull cloudposse/github-commenter:0.5.0-58
245- - run :
246- name : Comment
247- command : |
248- ALPHA_PACKAGES="$(yarn lerna ll --parseable | grep alpha || true)"
249- if [ -z "$ALPHA_PACKAGES" ]
250- then
251- echo "No alpha published packages found, will not add PR comment"
252- else
253- docker run --rm \
254- -e GITHUB_TOKEN \
255- -e GITHUB_OWNER="${CIRCLE_PROJECT_USERNAME}" \
256- -e GITHUB_REPO="${CIRCLE_PROJECT_REPONAME}" \
257- -e GITHUB_COMMENT_TYPE=pr \
258- -e GITHUB_PR_ISSUE_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}" \
259- -e GITHUB_COMMENT_TEMPLATE='<h3>📬Published Alpha Packages:</h3><pre>{{$x := splitList "\n" .}}{{range $x}}{{$y := split ":" .}}{{printf "%s@%v<br/>" $y._1 $y._2}}{{end}}</pre><!--LERNA_VERSION_COMMENT-->' \
260- -e GITHUB_DELETE_COMMENT_REGEX="LERNA_VERSION_COMMENT" \
261- -e GITHUB_COMMENT="${ALPHA_PACKAGES}" \
262- cloudposse/github-commenter:0.5.0-58
263- fi
264-
265157workflows :
266158 version : 2
267159 build-test :
@@ -272,23 +164,12 @@ workflows:
272164 - checkout_code :
273165 requires :
274166 - queue/block_workflow
275- - tests :
276- requires :
277- - checkout_code
278167 - publish :
279168 requires :
280169 - checkout_code
281170 filters :
282171 branches :
283172 only : main
284- - publish_alpha :
285- filters :
286- branches :
287- ignore :
288- - main
289- - gh-pages
290- requires :
291- - checkout_code
292173
293174 deploy :
294175 jobs :
@@ -304,11 +185,3 @@ workflows:
304185 filters :
305186 branches :
306187 only : main
307- - deploy_alpha :
308- filters :
309- branches :
310- ignore :
311- - main
312- - gh-pages
313- requires :
314- - checkout_code
0 commit comments