Skip to content

Commit 9c73be5

Browse files
authored
Add files via upload
1 parent 04362a9 commit 9c73be5

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

nextjs.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Deploy - Github Pages
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: true
16+
17+
jobs:
18+
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
- name: Detect package manager
25+
id: detect-package-manager
26+
run: |
27+
if [ -f "${{ github.workspace }}/package.json" ]; then
28+
echo "::set-output name=manager::npm"
29+
echo "::set-output name=command::ci"
30+
echo "::set-output name=runner::npx --no-install"
31+
exit 0
32+
else
33+
echo "Unable to determine packager manager"
34+
exit 1
35+
fi
36+
- name: Setup Node
37+
uses: actions/setup-node@v3
38+
with:
39+
node-version: "18"
40+
cache: ${{ steps.detect-package-manager.outputs.manager }}
41+
- name: Setup Pages
42+
uses: actions/configure-pages@v2
43+
with:
44+
static_site_generator: next
45+
- name: Restore cache
46+
uses: actions/cache@v3
47+
with:
48+
path: |
49+
.next/cache
50+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
51+
restore-keys: |
52+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
53+
- name: Install dependencies
54+
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
55+
- name: Build with Next.js
56+
run: ${{ steps.detect-package-manager.outputs.runner }} next build
57+
- name: Static HTML export with Next.js
58+
run: ${{ steps.detect-package-manager.outputs.runner }} next export
59+
- run: echo '' > ./out/_next/.nojekyll
60+
- name: Upload artifact
61+
uses: actions/upload-pages-artifact@v1
62+
with:
63+
path: ./out
64+
65+
deploy:
66+
environment:
67+
name: github-pages
68+
url: ${{ steps.deployment.outputs.page_url }}
69+
runs-on: ubuntu-latest
70+
needs: build
71+
steps:
72+
- name: Deploy to GitHub Pages
73+
id: deployment
74+
uses: actions/deploy-pages@v1
75+

0 commit comments

Comments
 (0)