Skip to content

Commit 532beff

Browse files
committed
add pages workflow
1 parent 1af9772 commit 532beff

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

.github/workflows/pages.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Deploy Next.js site to Pages
2+
3+
on:
4+
# Runs on pushes targeting the default branch
5+
push:
6+
branches: ["main"]
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
# Allow one concurrent deployment
17+
concurrency:
18+
group: "pages"
19+
cancel-in-progress: true
20+
21+
jobs:
22+
# Build job
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
- uses: pnpm/action-setup@v2
29+
with:
30+
version: 8
31+
- name: Setup Node
32+
uses: actions/setup-node@v3
33+
with:
34+
cache: 'pnpm'
35+
- name: Setup Pages
36+
uses: actions/configure-pages@v2
37+
- name: Restore cache
38+
uses: actions/cache@v3
39+
with:
40+
path: |
41+
.ssr-test/cache
42+
# Generate a new cache whenever packages or source files change.
43+
key: ${{ runner.os }}-ssr-test-${{ hashFiles('**/pnpm-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
44+
# If source files changed but packages didn't, rebuild from a prior cache.
45+
restore-keys: |
46+
${{ runner.os }}-ssr-test-${{ hashFiles('**/pnpm-lock.json') }}-
47+
- name: Install dependencies
48+
run: pnpm install --no-frozen-lockfile
49+
- name: Build
50+
run: |
51+
export NODE_OPTIONS=--max_old_space_size=8193
52+
pnpm build
53+
- name: Collect static pages
54+
run: pnpm build:pages
55+
- name: Upload artifact
56+
uses: actions/upload-pages-artifact@v1
57+
58+
# Deployment job
59+
deploy:
60+
environment:
61+
name: github-pages
62+
url: ${{ steps.deployment.outputs.page_url }}
63+
runs-on: ubuntu-latest
64+
needs: build
65+
steps:
66+
- name: Deploy to GitHub Pages
67+
id: deployment
68+
uses: actions/deploy-pages@v1

apps/cra/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "ssr-test-cra",
33
"version": "0.0.0",
44
"private": true,
5+
"homepage": "/ssr-test/cra",
56
"scripts": {
67
"start": "serve -s build -l 3000",
78
"dev": "react-scripts start",

apps/web/next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
22
reactStrictMode: true,
33
transpilePackages: ["raw-and-dist-src"],
4+
basePath: '/ssr-test/next'
45
};

0 commit comments

Comments
 (0)