This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (48 loc) · 1.61 KB
/
deploy-to-preview.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
50
51
52
name: Deploy to Preview
on:
push:
branches:
- develop
jobs:
deploy:
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
strategy:
matrix:
node-version: [14.15.0]
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v2
with:
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
path: "**/node_modules"
- run: yarn
- run: yarn global add vercel
- id: deployment-action
uses: chrnorm/deployment-action@releases/v1
with:
environment: Preview
token: ${{ secrets.GITHUB_TOKEN }}
- id: vercel
run: vercel -b GITHUB_REPOSITORY=$GITHUB_REPOSITORY -b GITHUB_SHA=$GITHUB_SHA -t $VERCEL_TOKEN > environment-url
- if: failure()
uses: chrnorm/deployment-status@releases/v1
with:
deployment_id: ${{ steps.deployment-action.outputs.deployment_id }}
state: failure
token: ${{ secrets.GITHUB_TOKEN }}
- id: environment-url
run: echo "::set-output name=body::$(cat environment-url)"
- uses: chrnorm/deployment-status@releases/v1
with:
deployment_id: ${{ steps.deployment-action.outputs.deployment_id }}
environment_url: ${{ steps.environment-url.outputs.body }}
state: success
token: ${{ secrets.GITHUB_TOKEN }}