-
-
Notifications
You must be signed in to change notification settings - Fork 19
43 lines (41 loc) · 1.5 KB
/
layer0.yaml
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
name: "Deploy branch to Layer0"
on:
push:
branches:
- gh-pages
permissions:
contents: read
jobs:
deploy-to-layer0:
# cancels the deployment for the automatic merge push created when tagging a release
if: contains(github.ref, 'refs/tags') == false || github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Check for Layer0 deploy token secret
if: env.layer0_deploy_token == ''
run: |
echo You must define the "layer0_deploy_token" secret in GitHub project settings
exit 1
env:
layer0_deploy_token: ${{secrets.layer0_deploy_token}}
- name: Extract branch name
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- name: Build
run: |
yarn install
yarn run build:index
working-directory: layer0/
- name: Deploy to Layer0
run: |
npm run layer0:deploy -- ${{'--branch=$BRANCH_NAME' || ''}} --token=$layer0_deploy_token \
${{github.event_name == 'push' && '--environment=default' || ''}} \
${{github.event_name == 'pull_request' && '--environment=staging' || ''}} \
${{github.event_name == 'release' && '--environment=production' || ''}}
env:
layer0_deploy_token: ${{secrets.layer0_deploy_token}}
working-directory: layer0/