Skip to content

Commit

Permalink
Merge pull request #4 from fossuok/dev
Browse files Browse the repository at this point in the history
set up Github actions for static deployment
  • Loading branch information
PinsaraPerera authored Nov 26, 2024
2 parents 28e21be + 151a357 commit 2de0139
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 6 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: npm install

- name: Build and Export
run: npm run build && npm run export

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
33 changes: 27 additions & 6 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
import nextra from 'nextra'

const withNextra = nextra({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.jsx'
})
// const withNextra = nextra({
// theme: 'nextra-theme-docs',
// themeConfig: './theme.config.jsx'
// })

export default withNextra()
// export default withNextra()

// If you have other Next.js configurations, you can pass them as the parameter:
// export default withNextra({ /* other next.js config */ })
// export default withNextra({ /* other next.js config */ })

const withNextra = nextra({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.jsx',
});

const isProd = process.env.NODE_ENV === 'production';

export default withNextra({
// Ensure the project builds for static export
output: 'export',

// Support for GitHub Pages
basePath: isProd ? '/nextra-doc-template' : '', // Replace <REPOSITORY_NAME> with your GitHub repo name
assetPrefix: isProd ? '/nextra-doc-template' : '',

// Required if you're using next/image
images: {
unoptimized: true,
},
});

0 comments on commit 2de0139

Please sign in to comment.