-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (30 loc) · 1.14 KB
/
static-react-example.yml
File metadata and controls
32 lines (30 loc) · 1.14 KB
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
name: Deploy Static React Example to Layer0
on: push
jobs:
deploy-example:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_ENV
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 14
- name: Cache node modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Static React Example - Deploy to Layer0
run: |
npm ci
npm run layer0:deploy -- ${{'--branch=$BRANCH_NAME' || ''}} --token=$layer0_deploy_token ${{env.BRANCH_NAME != 'master' && '--environment=staging' || ''}}
env:
layer0_deploy_token: ${{secrets.LAYER0_DEPLOY_TOKEN}}