Skip to content

Commit

Permalink
ci: added github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
thepuskar committed Nov 18, 2024
1 parent b5fa1c9 commit 7baea48
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 5 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy Nextra App to GitHub Pages

on:
push:
branches:
- main # Trigger on pushes to the main branch
pull_request:
branches:
- main # Trigger on PRs targeting the main branch

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v3

# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18" # Use the Node.js version that works with your project
cache: "npm"

# Step 3: Install dependencies inside the docs directory
- name: Install dependencies
run: |
cd docs
npm install
# Step 4: Build the project inside the docs directory
- name: Build project
run: |
cd docs
npm run build
# Step 5: Export the project to static files
- name: Export to static files
run: |
cd docs
npm run export
# Step 6: Deploy to GitHub Pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/out # The export output will be in docs/out
publish_branch: gh-pages # The branch to deploy to, typically 'gh-pages'
16 changes: 11 additions & 5 deletions docs/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const withNextra = require('nextra')({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.tsx',
})
const withNextra = require("nextra")({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.tsx",
});

module.exports = withNextra()
module.exports = withNextra({
basePath: "/custom-hooks",
assetPrefix: "/custom-hooks",
images: {
unoptimized: true, // Necessary for GitHub Pages
},
});

0 comments on commit 7baea48

Please sign in to comment.