forked from PinsaraPerera/nextra-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from fossuok/dev
set up Github actions for static deployment
- Loading branch information
Showing
2 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
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
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 |
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
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, | ||
}, | ||
}); |