CI fix #354
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | |
- 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 |