-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (49 loc) · 2.08 KB
/
preview-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Preview Client Build
on: [push]
jobs:
deploy_client:
name: Deploy Client
runs-on: ubuntu-latest
timeout-minutes: 15
environment:
name: preview_client
url: ${{ steps.wrangler.outputs.preview_url }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: "18.6"
cache: "npm"
- name: Install lerna
run: |
npm install
- name: Install dependencies
run: |
npx lerna bootstrap --ci
- name: Build client
working-directory: ./packages/client
env:
SKIP_PREFLIGHT_CHECK: true
REACT_APP_AUTH0_CLIENT_ID: ${{ secrets.REACT_APP_AUTH0_CLIENT_ID }}
REACT_APP_AUTH0_DOMAIN: ${{ secrets.REACT_APP_AUTH0_DOMAIN }}
REACT_APP_AUTH0_SCOPE: "openid profile email permissions"
REACT_APP_AUTH0_AUDIENCE: https://api.seasketch.org
REACT_APP_MAPBOX_ACCESS_TOKEN: ${{ secrets.REACT_APP_MAPBOX_ACCESS_TOKEN }}
REACT_APP_GRAPHQL_ENDPOINT: ${{ secrets.REACT_APP_GRAPHQL_ENDPOINT }}
REACT_APP_BUILD: ${{ steps.short_sha.outputs.sha }}
REACT_APP_SENTRY_DSN: ${{ secrets.REACT_APP_SENTRY_DSN }}
REACT_APP_CLOUDFRONT_DOCS_DISTRO: ${{ secrets.REACT_APP_CLOUDFRONT_DOCS_DISTRO }}
REACT_APP_CLOUDFLARE_IMAGES_ENDPOINT: ${{ secrets.REACT_APP_CLOUDFLARE_IMAGES_ENDPOINT }}
run: |
CI=false npm run build
- name: deploy to cloudflare pages
id: wrangler
working-directory: ./packages/client
env:
CLOUDFLARE_ACCOUNT_ID: ${{secrets.CLOUDFLARE_ACCOUNT_ID}}
CLOUDFLARE_API_TOKEN: ${{secrets.CLOUDFLARE_API_TOKEN}}
run: |
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BRANCH=$(if [ $BRANCH = "master" ]; then echo "master-preview"; else echo $BRANCH; fi)
URL=$(npx wrangler pages publish build --project-name=seasketch-next-client --commit-dirty=true --branch $BRANCH | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | sort -u)
echo "preview_url=$(echo $URL)" >> $GITHUB_OUTPUT