Skip to content

Commit cbb33a1

Browse files
Always set the public URL. (#987)
All deployment stages now require it.
1 parent ad32bac commit cbb33a1

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

.circleci/config.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ _steps:
2929
paths:
3030
- .npm-cache
3131
key: npm-v1-{{ .Branch }}-{{ checksum "package-lock.json" }}
32+
set_public_url:
33+
&set_public_url # Set PUBLIC_URL based on the deployment prefix. PUBLIC_URL is equivalent to CRA's package.json homepage setting https://create-react-app.dev/docs/advanced-configuration/
34+
run:
35+
name: "Set PUBLIC_URL"
36+
environment:
37+
NODE_PATH: /usr/local/lib/node_modules
38+
# Two env vars as PUBLIC_URL seems to be blank when running jest even if we set it.
39+
command: URL=$(npm run --silent public-url); echo "export PUBLIC_URL=$URL && export E2E_PUBLIC_URL=$URL" >> $BASH_ENV
40+
3241
install_aws_cli: &install_aws_cli
3342
run: sudo apt-get update && sudo apt-get install awscli
3443
install_dependencies: &install_dependencies
@@ -42,7 +51,7 @@ _steps:
4251
name: Build
4352
command: npm run ci
4453
# https://circleci.com/orbs/registry/orb/threetreeslight/puppeteer
45-
chrome-deps: &chrome-deps
54+
chrome_deps: &chrome_deps
4655
run:
4756
name: Install Headless Chrome dependencies
4857
command: |
@@ -51,17 +60,12 @@ _steps:
5160
libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 \
5261
libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 \
5362
libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
54-
serve-review: &serve-review
55-
run:
56-
name: Serve files for e2e tests (review)
57-
command: mkdir /tmp/app && cp -r build /tmp/app${PUBLIC_URL} && npx serve --no-clipboard -l 3000 /tmp/app
58-
background: true
5963
serve: &serve
6064
run:
6165
name: Serve files for e2e tests
62-
command: npm run serve
66+
command: mkdir /tmp/app && cp -r build /tmp/app${PUBLIC_URL} && npx serve --no-clipboard -l 3000 /tmp/app
6367
background: true
64-
serve-wait: &serve-wait
68+
serve_wait: &serve_wait
6569
run:
6670
name: Wait for e2e server
6771
command: "curl --insecure -4 --retry 7 --retry-connrefused http://localhost:3000 1>/dev/null"
@@ -106,21 +110,15 @@ jobs:
106110
- *install_theme
107111
- *update_version
108112
- *save_npm_cache
109-
# Set PUBLIC_URL based on the bucket prefix. PUBLIC_URL is equivalent to CRA's package.json homepage setting https://create-react-app.dev/docs/advanced-configuration/
110-
- run:
111-
name: "Set PUBLIC_URL for review branch"
112-
environment:
113-
NODE_PATH: /usr/local/lib/node_modules
114-
# Two env vars as PUBLIC_URL seems to be blank when running jest even if we set it.
115-
command: URL=$(npm run --silent public-url); echo "export PUBLIC_URL=$URL && export E2E_PUBLIC_URL=$URL" >> $BASH_ENV
113+
- *set_public_url
116114
- *build
117115
# Unlike other stages deploy, first so we still get deployments when e2e fails.
118116
- *queue_until_front_of_line
119117
- *deploy
120118
- *invalidate
121-
- *chrome-deps
122-
- *serve-review
123-
- *serve-wait
119+
- *chrome_deps
120+
- *serve
121+
- *serve_wait
124122
- *e2e
125123
- *store_reports
126124

@@ -140,13 +138,14 @@ jobs:
140138
- *install_theme
141139
- *update_version
142140
- *save_npm_cache
141+
- *set_public_url
143142
- *build
144-
- *queue_until_front_of_line
145-
- *chrome-deps
143+
- *chrome_deps
146144
- *serve
147-
- *serve-wait
145+
- *serve_wait
148146
- *e2e
149147
- *store_reports
148+
- *queue_until_front_of_line
150149
- *deploy
151150
- *invalidate
152151

@@ -166,6 +165,7 @@ jobs:
166165
- *install_theme
167166
- *update_version
168167
- *save_npm_cache
168+
- *set_public_url
169169
- *build
170170
# This doesn't work for tags. Don't release more than one at once!
171171
# - *queue_until_front_of_line

0 commit comments

Comments
 (0)