@@ -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,7 +111,7 @@ 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
@@ -176,92 +176,6 @@ jobs:
176176 - *save_nx_cache
177177 - *save_webpack_cache
178178
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 netlify-cli@17.37.1 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-
265179workflows :
266180 version : 2
267181 build-test :
@@ -281,14 +195,6 @@ workflows:
281195 filters :
282196 branches :
283197 only : main
284- - publish_alpha :
285- filters :
286- branches :
287- ignore :
288- - main
289- - gh-pages
290- requires :
291- - checkout_code
292198
293199 deploy :
294200 jobs :
@@ -304,11 +210,3 @@ workflows:
304210 filters :
305211 branches :
306212 only : main
307- - deploy_alpha :
308- filters :
309- branches :
310- ignore :
311- - main
312- - gh-pages
313- requires :
314- - checkout_code
0 commit comments