Skip to content

Commit

Permalink
ci: Update GitHub Actions workflow for Next.js deployment and configu…
Browse files Browse the repository at this point in the history
…re basePath
  • Loading branch information
MAVRICK-1 committed Nov 21, 2024
1 parent ebd9a35 commit 56b4fb2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,21 @@
name: Deploy Next.js site to Pages

on:
# Trigger on pushes to the dev branch
push:
branches: ["dev"]

# Allow manual triggers from the Actions tab
workflow_dispatch:

# Permissions for deployment
permissions:
contents: read
pages: write
id-token: write

# Concurrency settings
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -56,19 +51,14 @@ jobs:
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}

- name: Configure for GitHub Pages
run: |
echo "module.exports = { basePath: '/<REPOSITORY_NAME>' };" > next.config.js
- name: Build and export the site
run: ${{ steps.detect-package-manager.outputs.runner }} next build && ${{ steps.detect-package-manager.outputs.runner }} next export
run: ${{ steps.detect-package-manager.outputs.runner }} next build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./out

# Deployment job
deploy:
environment:
name: github-pages
Expand Down
5 changes: 4 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
const nextConfig = {
output: 'export',
basePath: '/new-website',
}

module.exports = nextConfig

0 comments on commit 56b4fb2

Please sign in to comment.