change next.config.ts basepath #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Frontend | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
defaults: | |
run: | |
working-directory: frontend # Set working directory to frontend | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Detect package manager | |
id: detect-package-manager | |
run: | | |
if [ -f "pnpm-lock.yaml" ]; then | |
echo "manager=pnpm" >> $GITHUB_OUTPUT | |
echo "command=install" >> $GITHUB_OUTPUT | |
echo "runner=pnpm" >> $GITHUB_OUTPUT | |
exit 0 | |
else | |
echo "Unable to determine package manager" | |
exit 1 | |
fi | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
cache-dependency-path: frontend/pnpm-lock.yaml | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
with: | |
static_site_generator: next | |
- name: Restore cache | |
uses: actions/cache@v4 | |
with: | |
path: .next/cache # Ensure path is inside frontend folder | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml', 'yarn.lock', 'package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml', 'yarn.lock', 'package-lock.json') }}- | |
- name: Install dependencies | |
run: pnpm install # Use pnpm to install dependencies | |
- name: Build with Next.js | |
run: pnpm run build # Use pnpm to run the build | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: frontend/out # Output static files from the 'out' folder inside frontend | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |