Skip to content
This repository was archived by the owner on Mar 27, 2023. It is now read-only.

Commit 124c466

Browse files
committed
chore(build): update netlify to auto deploy after merge
This looks at the GitHub ENV variables to determine if this is a commit on the host branch or a PR. Signed-off-by: Jeremy Wilken <[email protected]>
1 parent 29fede2 commit 124c466

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

.github/workflows/build.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@ on: [push, pull_request]
55
jobs:
66
build:
77
runs-on: ubuntu-latest
8-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'vmware/clarity'
8+
if: github.repository == 'vmware/clarity'
99

1010
steps:
1111
- uses: actions/checkout@v2
1212
- uses: actions/setup-node@v1
1313
with:
1414
node-version: '14.x'
15-
- uses: actions/cache@v2
16-
with:
17-
path: '**/node_modules'
18-
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}-${{ github.base_ref }}
1915
- run: npm install
2016
- run: npm run build
2117
- run: npm run deploy

scripts/adoption.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env bash
22

3-
mkdir -p logs
4-
53
# This downloads a set of key-value env variables, but blocks any requests that aren't from GitHub Actions
64
curl -g https://us-central1-clarity-design-system.cloudfunctions.net/actions -o .env
75
# dotenv loads up the env variables into the shell, then deploys through Netlify
86

9-
# Deploy a preview that can be promoted to production when we are ready
10-
node -r dotenv/config -- ./node_modules/.bin/netlify deploy --json --dir=./dist/adoption --message="Adoption Branch - Adoption Guide - $GITHUB_REF@$GITHUB_SHA" --site "adoption.clarity.design" > ./logs/adoption.clarity.design.netlify.json
11-
cat ./logs/adoption.clarity.design.netlify.json
7+
[ "$GITHUB_REF" == "refs/head/adoption" ] &&
8+
# Deploy to production
9+
node -r dotenv/config -- ./node_modules/.bin/netlify deploy --json --dir=./dist/adoption --message="$GITHUB_REF@$GITHUB_SHA" --prod ||
10+
# Deploy a preview
11+
node -r dotenv/config -- ./node_modules/.bin/netlify deploy --json --dir=./dist/adoption --message="$GITHUB_REF@$GITHUB_SHA"

0 commit comments

Comments
 (0)