-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (41 loc) · 1.13 KB
/
deploy-preview.yml
File metadata and controls
50 lines (41 loc) · 1.13 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Deploy on Preview
on:
pull_request:
types: [opened, synchronize]
workflow_dispatch:
inputs:
BRANCH:
description: "Branch to Deploy"
required: true
default: "main"
type: "string"
defaults:
run:
working-directory: scripts/deploy
concurrency:
group: preview-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
env:
BRANCH: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name || inputs.BRANCH }}
TARGET_ENV: 'preview'
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm ci
- name: Create .env file
run: |
echo "VERCEL_TOKEN=${{ secrets.VERCEL_TOKEN }}" >> .env
echo "BRANCH=${{ env.BRANCH }}" >> .env
echo "TARGET_ENV=${{ env.TARGET_ENV }}" >> .env
- name: Cat .env file
run: cat .env
- name: Run Deploy Script
run: npm run deploy