-
Notifications
You must be signed in to change notification settings - Fork 25
65 lines (51 loc) · 1.86 KB
/
deploy-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
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Deploy to Vercel Preview
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_DOCS_ID }}
on:
pull_request:
jobs:
deploy:
environment:
name: Docs - Preview
url: ${{ steps.deployment.outputs.url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
show-progress: false
- name: Runner Setup
uses: ./.github/actions/runner-setup
- name: Detecting App Changes
id: detectChanges
run: |
echo "Detecting Changes"
# Enable Error Handling
set +e
npx turbo-ignore @kadena/docs -f ${{ github.base_ref }}
exit_code=$?
# Disable Error Handling
set -e
echo "exit_code: $exit_code"
if [ $exit_code -eq 0 ]; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Install Vercel CLI
if: steps.detectChanges.outputs.changed == 'true'
run: pnpm add --global vercel@34.2.5
- name: Pull Vercel Environment Information
if: steps.detectChanges.outputs.changed == 'true'
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build App for Vercel Deployment
if: steps.detectChanges.outputs.changed == 'true'
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
if: steps.detectChanges.outputs.changed == 'true'
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} --archive=tgz --meta pr_number=${{ github.event.number }} | tee deploy.log
- name: Set preview url
if: steps.detectChanges.outputs.changed == 'true'
id: deployment
run: echo "url=$(tail -1 deploy.log)">> $GITHUB_OUTPUT