File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 push :
55 branches : ["main"]
66 pull_request :
7- branches :
8- - main
7+ branches : ["main"]
98 workflow_dispatch :
109
1110permissions :
@@ -20,6 +19,8 @@ concurrency:
2019jobs :
2120 build-and-test :
2221 runs-on : ubuntu-latest
22+ outputs :
23+ build-path : ./out
2324 steps :
2425 - name : Checkout
2526 uses : actions/checkout@v4
@@ -31,12 +32,10 @@ jobs:
3132 echo "manager=yarn" >> $GITHUB_OUTPUT
3233 echo "command=install" >> $GITHUB_OUTPUT
3334 echo "runner=yarn" >> $GITHUB_OUTPUT
34- exit 0
3535 elif [ -f "${{ github.workspace }}/package.json" ]; then
3636 echo "manager=npm" >> $GITHUB_OUTPUT
3737 echo "command=ci" >> $GITHUB_OUTPUT
3838 echo "runner=npx --no-install" >> $GITHUB_OUTPUT
39- exit 0
4039 else
4140 echo "Unable to determine package manager"
4241 exit 1
@@ -67,18 +66,25 @@ jobs:
6766 - name : Build with Next.js
6867 run : pnpm run build
6968
70- - name : Upload artifact
71- uses : actions/upload-pages- artifact@v3
69+ - name : Upload build artifact
70+ uses : actions/upload-artifact@v3
7271 with :
72+ name : nextjs-build
7373 path : ./out
7474
7575 deploy :
76- environment :
77- name : github-pages
78- url : ${{ steps.deployment.outputs.page_url }}
7976 runs-on : ubuntu-latest
8077 needs : build-and-test
78+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
79+ environment :
80+ name : github-pages
8181 steps :
82+ - name : Download build artifact
83+ uses : actions/download-artifact@v3
84+ with :
85+ name : nextjs-build
86+ path : ./out
87+
8288 - name : Deploy to GitHub Pages
8389 id : deployment
8490 uses : actions/deploy-pages@v4
You can’t perform that action at this time.
0 commit comments