2023-12-14 04:41:03 -05:00
|
|
|
steps:
|
2023-12-14 05:41:27 -05:00
|
|
|
- id: npm_ci
|
2024-04-24 03:39:51 -04:00
|
|
|
name: "node:18.20.2"
|
2023-12-14 05:41:27 -05:00
|
|
|
entrypoint: /bin/bash
|
|
|
|
args:
|
|
|
|
- '-c'
|
|
|
|
- 'bin/npm_install_subset . libraries/* services/web'
|
|
|
|
|
2023-12-14 04:41:03 -05:00
|
|
|
- id: build-storybook
|
2024-04-24 03:39:51 -04:00
|
|
|
name: 'node:18.20.2'
|
2023-12-14 04:41:03 -05:00
|
|
|
env:
|
|
|
|
- 'BRANCH_NAME=$BRANCH_NAME'
|
|
|
|
- 'BUILD_ID=$BUILD_ID'
|
|
|
|
script: |
|
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
make -C services/web BRANCH_NAME="${BRANCH_NAME:-$BUILD_ID}" build_storybook
|
|
|
|
|
|
|
|
- id: deploy-storybook
|
|
|
|
name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
|
|
|
|
env:
|
|
|
|
- 'BRANCH_NAME=$BRANCH_NAME'
|
|
|
|
- 'BUILD_ID=$BUILD_ID'
|
|
|
|
- 'BUCKET=gs://overleaf-dev-storybook'
|
|
|
|
dir: services/web
|
|
|
|
script: |
|
|
|
|
#!/bin/bash
|
|
|
|
: ${BRANCH_NAME:=$BUILD_ID}
|
|
|
|
[[ "$BRANCH_NAME" ]] || {
|
|
|
|
echo 1>&2 "ERROR: BRANCH_NAME not set"
|
|
|
|
exit 2
|
|
|
|
}
|
|
|
|
gsutil -m copy -r storybook-output/* "${BUCKET}/"
|
|
|
|
waitFor:
|
|
|
|
- build-storybook
|
|
|
|
|
|
|
|
- id: read-storybook-bucket
|
|
|
|
name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
|
|
|
|
dir: services/web
|
|
|
|
env:
|
|
|
|
- 'BUCKET=gs://overleaf-dev-storybook'
|
|
|
|
script: |
|
|
|
|
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
gsutil ls "${BUCKET}/" \
|
|
|
|
| sed -E "s@^${BUCKET}/([^/]+)/@\1@" \
|
|
|
|
> storybook-bucket-listing.txt
|
|
|
|
waitFor:
|
|
|
|
- deploy-storybook
|
|
|
|
|
|
|
|
- id: create-storybook-index
|
2024-04-24 03:39:51 -04:00
|
|
|
name: 'node:18.20.2'
|
2023-12-14 04:41:03 -05:00
|
|
|
dir: services/web
|
|
|
|
env:
|
|
|
|
- 'BRANCH_NAME=$BRANCH_NAME'
|
|
|
|
script: |
|
|
|
|
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
LIST=$(tr '\n' , < storybook-bucket-listing.txt)
|
|
|
|
m4 -DLIST="$LIST" -DBRANCH_NAME="$BRANCH_NAME" cloudbuild-storybook-index.html.m4 > storybook-index.html
|
|
|
|
waitFor:
|
|
|
|
- read-storybook-bucket
|
|
|
|
|
|
|
|
- id: update-storybook-index
|
|
|
|
name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
|
|
|
|
dir: services/web
|
|
|
|
entrypoint: 'gsutil'
|
|
|
|
args: [ "copy", "storybook-index.html", "gs://overleaf-dev-storybook/index.html" ]
|
|
|
|
waitFor:
|
|
|
|
- create-storybook-index
|