1- # Sample workflow for building and deploying a Next.js site to GitHub Pages
1+ # Sample workflow for building and deploying an Astro site to GitHub Pages
22#
3- # To get started with Next.js see: https://nextjs.org/docs /getting-started
3+ # To get started with Astro see: https://docs.astro.build/en /getting-started/
44#
5- name : Deploy Next.js site to Pages
5+ name : Deploy Astro site to Pages
66
77on :
88 # Runs on pushes targeting the default branch
@@ -24,9 +24,13 @@ concurrency:
2424 group : " pages"
2525 cancel-in-progress : false
2626
27+ env :
28+ BUILD_PATH : " ." # default value when not using subfolders
29+ # BUILD_PATH: subfolder
30+
2731jobs :
28- # Build job
2932 build :
33+ name : Build
3034 runs-on : ubuntu-latest
3135 steps :
3236 - name : Checkout
@@ -63,38 +67,32 @@ jobs:
6367 fi
6468
6569 - name : Setup Pages
70+ id : pages
6671 uses : actions/configure-pages@v5
67- with :
68- static_site_generator : next
6972
70- - name : Restore cache
71- uses : actions/cache@v4
72- with :
73- path : |
74- .next/cache
75- # Generate a new cache whenever packages or source files change.
76- key : ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
77- # If source files changed but packages didn't, rebuild from a prior cache.
78- restore-keys : |
79- ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml') }}-
8073 - name : Install dependencies
8174 run : ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
82- - name : Build with Next.js
83- run : ${{ steps.detect-package-manager.outputs.runner }} next build
84- env :
85- NEXT_PUBLIC_BASE_PATH : " /official-site-guayaba"
75+ working-directory : ${{ env.BUILD_PATH }}
76+
77+ - name : Build with Astro
78+ run : |
79+ ${{ steps.detect-package-manager.outputs.runner }} astro build \
80+ --site "${{ steps.pages.outputs.origin }}" \
81+ --base "${{ steps.pages.outputs.base_path }}"
82+ working-directory : ${{ env.BUILD_PATH }}
83+
8684 - name : Upload artifact
8785 uses : actions/upload-pages-artifact@v3
8886 with :
89- path : ./out
87+ path : ${{ env.BUILD_PATH }}/dist
9088
91- # Deployment job
9289 deploy :
9390 environment :
9491 name : github-pages
9592 url : ${{ steps.deployment.outputs.page_url }}
96- runs-on : ubuntu-latest
9793 needs : build
94+ runs-on : ubuntu-latest
95+ name : Deploy
9896 steps :
9997 - name : Deploy to GitHub Pages
10098 id : deployment
0 commit comments