From e87797d5a13ae0adaa113fb646bd0fd752c41ce3 Mon Sep 17 00:00:00 2001 From: "Alejo A. Sotelo" Date: Thu, 8 May 2025 22:32:37 -0300 Subject: [PATCH] Deploy API documentation to GitHub Pages Update GitHub Actions workflow to deploy documentation to GitHub Pages. * Change branch name from `main` to `master` in `.github/workflows/deploy.yml` under `on: push: branches:` --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/alejoasotelo/andreani-api-docs?shareId=XXXX-XXXX-XXXX-XXXX). --- .github/workflows/deploy.yml | 31 +++++++++++++++++++++++++++++++ .gitignore | 2 +- README.md | 23 +++++++++++++++++++++++ package.json | 6 ++++-- 4 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..cf5a707 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,31 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install dependencies + run: npm install + + - name: Build project + run: npm run build + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./out diff --git a/.gitignore b/.gitignore index 55a12ae..143e391 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,4 @@ yarn-error.log* # others .env*.local .vercel -next-env.d.ts \ No newline at end of file +next-env.d.ts diff --git a/README.md b/README.md index 74ba69c..d9a87a8 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,26 @@ resources: features and API. - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - [Fumadocs](https://fumadocs.vercel.app) - learn about Fumadocs + +## Deploying to GitHub Pages + +To deploy the documentation to GitHub Pages, follow these steps: + +1. Ensure you have the `gh-pages` package installed. If not, you can install it by running: + ```bash + npm install gh-pages --save-dev + ``` + +2. Add the following `deploy` script to your `package.json` file: + ```json + "scripts": { + "deploy": "npm run build && npx gh-pages -d out" + } + ``` + +3. Run the deploy script to build and deploy the documentation to GitHub Pages: + ```bash + npm run deploy + ``` + +4. Ensure the `out` directory is included in the `.gitignore` file to avoid committing build artifacts. diff --git a/package.json b/package.json index 4aa21d1..444114b 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "dev": "next dev --turbo", "start": "next start", "postinstall": "fumadocs-mdx", - "generate-docs": "node scripts/generate-docs.mjs" + "generate-docs": "node scripts/generate-docs.mjs", + "deploy": "npm run build && npx gh-pages -d out" }, "dependencies": { "fumadocs-core": "15.2.15", @@ -18,7 +19,8 @@ "next": "15.3.1", "react": "^19.1.0", "react-dom": "^19.1.0", - "shiki": "^3.4.0" + "shiki": "^3.4.0", + "gh-pages": "^4.0.0" }, "devDependencies": { "@tailwindcss/postcss": "^4.1.5",