Hey,
We deploy to different environments and use env vars and stages to configure the build script that runs like so:
# extract
jobs:
include:
- stage: test
name: lint css
script: npm run lint:css
- script: npm run lint
name: lint
- script: npm run flow
name: flow
- script:
- npm run test
name: test
- stage: uk-builds-development
if: branch != master
script: skip
env:
- CLUSTERSET_NAME=US-1
- MORE_ENV=VARS
deploy:
- provider: s3
skip_cleanup: true
secret_access_key: "$key"
access_key_id: "$key"
bucket: "$bucket1"
acl: public_read
region: <region1>
upload_dir: <upload_dir
local_dir: build
on:
all_branches: true
- stage: us-builds-development
if: branch != master
script: skip
env:
- CLUSTERSET_NAME=US-1
- MORE_ENV=VARS
deploy:
- provider: s3
skip_cleanup: true
secret_access_key: "$key"
access_key_id: "$key"
bucket: "$bucket2"
acl: public_read
region: <region2>
upload_dir: <upload_dir
local_dir: build
on:
all_branches: true
And then out npm build
runs build.sh
which looks something like:
CLUSTERSET_NAME=$CLUSTERSET_NAME
MORE_ENV=$MORE_ENV
npx webpack-cli --mode production --progress -p --colors
The tests run in parallel (super!) but the deploys run sequentially (not super).
We went with build stages because that’s the only way I could see to change env vars per deploy while also changing some properties of the deploy eg. the region.
Is there any way to achieve the same result but have the jobs run in parallel?
Cheers!