-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
40 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Build and Deploy to Netlify | ||
name: Build and Deploy to Vercel | ||
|
||
on: | ||
push: | ||
|
@@ -10,24 +10,13 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install pnpm | ||
run: npm install -g pnpm | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Build Project | ||
run: pnpm run build | ||
|
||
- name: Deploy to Netlify | ||
uses: nwtgck/[email protected] | ||
- name: Deploy to Vercel | ||
uses: BetaHuhn/deploy-to-vercel-action@v1 | ||
with: | ||
publish-dir: ./dist | ||
production-branch: main | ||
deploy-message: ${{ github.event.head_commit.message }} | ||
github-token: ${{ secrets.GH_TOKEN }} | ||
env: | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"rewrites": [ | ||
{ | ||
"source": "/((?!assets/).*", | ||
"destination": "vercel/ssr.js" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { renderPage } from "vite-plugin-ssr/server"; | ||
|
||
export default async function handler(req, res) { | ||
const { url } = req; | ||
|
||
if (!url) throw new Error("req.url is undefined"); | ||
|
||
const pageContextInit = { urlOriginal: url }; | ||
const pageContext = await renderPage(pageContextInit); | ||
const { httpResponse } = pageContext; | ||
|
||
if (!httpResponse) { | ||
res.statusCode = 200; | ||
res.end(); | ||
return; | ||
} | ||
|
||
const { body, statusCode, headers } = httpResponse; | ||
res.statusCode = statusCode; | ||
headers.forEach(([name, value]) => res.setHeader(name, value)); | ||
res.end(body); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters