Skip to content

Commit 840da5e

Browse files
committed
Adding preview with Vercel
1 parent 64ab3b7 commit 840da5e

File tree

2 files changed

+76
-61
lines changed

2 files changed

+76
-61
lines changed

.github/workflows/cloudflare.yml

-61
This file was deleted.

.github/workflows/vercel-preview.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Vercel Preview Deployment
2+
3+
on:
4+
push:
5+
branches:
6+
- vercel-preview
7+
pull_request:
8+
types: [opened, synchronize]
9+
10+
jobs:
11+
run:
12+
runs-on: ubuntu-latest
13+
env:
14+
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
15+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
16+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID}}
17+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID}}
18+
APP_ENV: prod
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 18
26+
cache: "npm"
27+
cache-dependency-path: "**/package-lock.json"
28+
29+
- name: Render Datasheets
30+
run: cd ${GITHUB_WORKSPACE}/scripts/datasheet-rendering;./render-datasheets.sh
31+
32+
- name: Copy Static Files
33+
run: |
34+
mkdir -p static/resources/datasheets static/resources/schematics static/resources/pinouts
35+
find ./content/hardware -type f -name "*-schematics.pdf" -exec cp {} ./static/resources/schematics/ \;
36+
find ./content/hardware -type f -name "*-datasheet.pdf" -exec cp {} ./static/resources/datasheets/ \;
37+
find ./content/hardware -type f -name "*-full-pinout.pdf" -exec cp {} ./static/resources/pinouts/ \;
38+
find ./content/hardware -type f -name "*-pinout.png" -exec cp {} ./static/resources/pinouts/ \;
39+
40+
- name: Gatsby main cache
41+
uses: actions/cache@v4
42+
id: gatsby-cache-folder
43+
with:
44+
path: .cache
45+
key: ${{ runner.os }}-cache-gatsbyV2-vercel-${{ github.sha }}
46+
restore-keys: |
47+
${{ runner.os }}-cache-gatsbyV2-vercel-
48+
49+
- name: Gatsby Public Folder
50+
uses: actions/cache@v4
51+
id: gatsby-public-folder
52+
with:
53+
path: public/
54+
key: ${{ runner.os }}-public-gatsbyV2-vercel-${{ github.sha }}
55+
restore-keys: |
56+
${{ runner.os }}-public-gatsbyV2-vercel-
57+
58+
- run: npm install
59+
- run: npm run build
60+
61+
- name: Install Vercel CLI
62+
run: npm install --global vercel@canary
63+
- name: Pull Vercel Environment Information
64+
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
65+
- name: Build Project Artifacts
66+
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
67+
68+
- uses: UnlyEd/github-action-deploy-on-vercel@latest
69+
with:
70+
command: "vercel deploy --archive=tgz --prebuilt --debug --token ${{ secrets.VERCEL_TOKEN }}"
71+
env:
72+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
73+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID}}
74+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
75+
76+
- run: "echo \"Found deployment url: ${{ env.VERCEL_DEPLOYMENT_URL }}\""

0 commit comments

Comments
 (0)