-
-
Notifications
You must be signed in to change notification settings - Fork 409
82 lines (67 loc) · 2.75 KB
/
vercel-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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Vercel Preview Deployment
on:
push:
branches:
- vercel-preview
pull_request:
types: [opened, synchronize]
concurrency:
group: vercel
cancel-in-progress: false
jobs:
run:
runs-on: ubuntu-latest
env:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID}}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID}}
APP_ENV: prod
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Render Datasheets
run: cd ${GITHUB_WORKSPACE}/scripts/datasheet-rendering;./render-datasheets.sh
- name: Copy Static Files
run: |
mkdir -p static/resources/datasheets static/resources/schematics static/resources/pinouts
find ./content/hardware -type f -name "*-schematics.pdf" -exec cp {} ./static/resources/schematics/ \;
find ./content/hardware -type f -name "*-datasheet.pdf" -exec cp {} ./static/resources/datasheets/ \;
find ./content/hardware -type f -name "*-full-pinout.pdf" -exec cp {} ./static/resources/pinouts/ \;
find ./content/hardware -type f -name "*-pinout.png" -exec cp {} ./static/resources/pinouts/ \;
- name: Gatsby main cache
uses: actions/cache@v4
id: gatsby-cache-folder
with:
path: .cache
key: ${{ runner.os }}-cache-gatsbyV2-vercel-${{ github.sha }}
restore-keys: |
${{ runner.os }}-cache-gatsbyV2-vercel-
- name: Gatsby Public Folder
uses: actions/cache@v4
id: gatsby-public-folder
with:
path: public/
key: ${{ runner.os }}-public-gatsbyV2-vercel-${{ github.sha }}
restore-keys: |
${{ runner.os }}-public-gatsbyV2-vercel-
- run: npm install
- run: npm run build
- name: Install Vercel CLI
run: npm install --global vercel@canary env-cmd
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- uses: UnlyEd/github-action-deploy-on-vercel@latest
with:
command: "vercel deploy --cwd ./public --archive=tgz --prebuilt --debug --token ${{ secrets.VERCEL_TOKEN }}"
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID}}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID}}
- run: "echo \"Found deployment url: ${{ env.VERCEL_DEPLOYMENT_URL }}\""