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
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name : CI Deploy
3
+ # name: Deploy static content to Pages
6
4
7
5
on :
8
6
# Runs on pushes targeting the default branch
9
7
push :
10
- branches : ["master" ]
8
+ branches : ['main' ]
11
9
12
10
# Allows you to run this workflow manually from the Actions tab
13
11
workflow_dispatch :
14
12
15
- # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13
+ # Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
16
14
permissions :
17
15
contents : read
18
16
pages : write
19
17
id-token : write
20
18
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.
19
+ # Allow one concurrent deployment
23
20
concurrency :
24
- group : " pages"
25
- cancel-in-progress : false
21
+ group : ' pages'
22
+ cancel-in-progress : true
26
23
27
24
jobs :
28
- # Build job
29
- build :
25
+ # Single deploy job since we're just deploying
26
+ deploy :
27
+ environment :
28
+ name : github-pages
29
+ url : ${{ steps.deployment.outputs.page_url }}
30
30
runs-on : ubuntu-latest
31
31
steps :
32
32
- name : Checkout
33
33
uses : actions/checkout@v3
34
- - name : Detect package manager
35
- id : detect-package-manager
36
- run : |
37
- if [ -f "${{ github.workspace }}/yarn.lock" ]; then
38
- echo "manager=yarn" >> $GITHUB_OUTPUT
39
- echo "command=install" >> $GITHUB_OUTPUT
40
- echo "runner=yarn" >> $GITHUB_OUTPUT
41
- exit 0
42
- elif [ -f "${{ github.workspace }}/package.json" ]; then
43
- echo "manager=npm" >> $GITHUB_OUTPUT
44
- echo "command=ci" >> $GITHUB_OUTPUT
45
- echo "runner=npx --no-install" >> $GITHUB_OUTPUT
46
- exit 0
47
- else
48
- echo "Unable to determine package manager"
49
- exit 1
50
- fi
51
- - name : Setup Node
34
+
35
+ - name : Setup pnpm
36
+
37
+ with :
38
+ version : 8.6.1
39
+ - name : Set up Node
52
40
uses : actions/setup-node@v3
53
41
with :
54
- node-version : " lts/*"
55
- cache : ${{ steps.detect-package-manager.outputs.manager }}
42
+ node-version : 18
43
+ cache : ' pnpm'
44
+ - name : Install dependencies
45
+ run : pnpm install --no-frozen-lockfile
46
+ - name : Build
47
+ run : npm run build
56
48
- name : Setup Pages
57
49
uses : actions/configure-pages@v3
58
- - name : Restore cache
59
- uses : actions/cache@v3
60
- with :
61
- path : |
62
- .next/cache
63
- # Generate a new cache whenever packages or source files change.
64
- key : ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
65
- # If source files changed but packages didn't, rebuild from a prior cache.
66
- restore-keys : |
67
- ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
68
- - name : Install dependencies
69
- run : ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
70
- - name : Build with Next.js
71
- run : ${{ steps.detect-package-manager.outputs.runner }} next build
72
50
- name : Upload artifact
73
51
uses : actions/upload-pages-artifact@v1
74
52
with :
75
- path : ./out
76
-
77
- # Deployment job
78
- deploy :
79
- environment :
80
- name : github-pages
81
- url : ${{ steps.deployment.outputs.page_url }}
82
- runs-on : ubuntu-latest
83
- needs : build
84
- steps :
53
+ # Upload dist repository
54
+ path : ' ./dist'
85
55
- name : Deploy to GitHub Pages
86
56
id : deployment
87
- uses : actions/deploy-pages@v2
57
+ uses : actions/deploy-pages@v1
0 commit comments