diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..0be04f4 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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 diff --git a/next.config.mjs b/next.config.mjs index ecc0fcb..d18b2b4 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -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 */ }) \ No newline at end of file +// 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 with your GitHub repo name + assetPrefix: isProd ? '/nextra-doc-template' : '', + + // Required if you're using next/image + images: { + unoptimized: true, + }, +});