Skip to content

Commit d004671

Browse files
committed
Deploy GH pages
1 parent 1485709 commit d004671

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Sample workflow for building and deploying a Next.js site to GitHub Pages
2+
#
3+
# To get started with Next.js see: https://nextjs.org/docs/getting-started
4+
#
5+
name: Deploy Next.js site to Pages
6+
7+
on:
8+
# Runs on pushes targeting the default branch
9+
push:
10+
branches: ['main']
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+
concurrency:
24+
group: 'pages'
25+
cancel-in-progress: false
26+
27+
jobs:
28+
# Build job
29+
build:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Detect package manager
36+
id: detect-package-manager
37+
run: |
38+
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
39+
echo "manager=yarn" >> $GITHUB_OUTPUT
40+
echo "command=install" >> $GITHUB_OUTPUT
41+
echo "runner=yarn" >> $GITHUB_OUTPUT
42+
exit 0
43+
elif [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then
44+
echo "manager=pnpm" >> $GITHUB_OUTPUT
45+
echo "command=install" >> $GITHUB_OUTPUT
46+
echo "runner=pnpm" >> $GITHUB_OUTPUT
47+
npm install -g pnpm
48+
exit 0
49+
elif [ -f "${{ github.workspace }}/package.json" ]; then
50+
echo "manager=npm" >> $GITHUB_OUTPUT
51+
echo "command=ci" >> $GITHUB_OUTPUT
52+
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
53+
exit 0
54+
else
55+
echo "Unable to determine package manager"
56+
exit 1
57+
fi
58+
59+
- name: Setup Node
60+
uses: actions/setup-node@v4
61+
with:
62+
node-version: 'lts/*'
63+
cache: ${{ steps.detect-package-manager.outputs.manager }}
64+
65+
- name: Setup Pages
66+
uses: actions/configure-pages@v4
67+
68+
- name: Restore cache
69+
uses: actions/cache@v4
70+
with:
71+
path: |
72+
.next/cache
73+
# Generate a new cache whenever packages or source files change.
74+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
75+
# If source files changed but packages didn't, rebuild from a prior cache.
76+
restore-keys: |
77+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
78+
79+
- name: Install dependencies
80+
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
81+
82+
- name: Build with Next.js
83+
run: ${{ steps.detect-package-manager.outputs.runner }} next build
84+
85+
- name: Upload artifact
86+
uses: actions/upload-pages-artifact@v3
87+
with:
88+
path: ./out
89+
90+
# Deployment job
91+
deploy:
92+
environment:
93+
name: github-pages
94+
url: ${{ steps.deployment.outputs.page_url }}
95+
runs-on: ubuntu-latest
96+
needs: build
97+
steps:
98+
- name: Deploy to GitHub Pages
99+
id: deployment
100+
uses: actions/deploy-pages@v4

public/.nojekyll

Whitespace-only changes.

0 commit comments

Comments
 (0)