Skip to content

Commit

Permalink
feat: github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
lilpacy committed Jun 27, 2024
1 parent e492a7a commit 05ac122
Show file tree
Hide file tree
Showing 4 changed files with 8,451 additions and 14,547 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/docusaurus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# ビルドステップ
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
fi
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Restore cache
uses: actions/cache@v3
with:
path: |
.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Build
run: ${{ steps.detect-package-manager.outputs.runner }} build
# ビルドステップ
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# ビルド出力パスを指定
path: build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
18 changes: 9 additions & 9 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';

const organizationName = "Animechain-ai";
const projectName = "animechain-docs";

const config: Config = {
title: 'My Site',
tagline: 'Dinosaurs are cool',
favicon: 'img/favicon.ico',

// Set the production url of your site here
url: 'https://your-docusaurus-site.example.com',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
url: `https://${organizationName}.github.io`,
baseUrl: `/${projectName}/`,

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
Expand All @@ -38,14 +38,14 @@ const config: Config = {
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
`https://github.com/${organizationName}/${projectName}/tree/main/packages/create-docusaurus/templates/shared/`,
},
blog: {
showReadingTime: true,
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
`https://github.com/${organizationName}/${projectName}/tree/main/packages/create-docusaurus/templates/shared/`,
},
theme: {
customCss: './src/css/custom.css',
Expand All @@ -72,7 +72,7 @@ const config: Config = {
},
{to: '/blog', label: 'Blog', position: 'left'},
{
href: 'https://github.com/facebook/docusaurus',
href: `https://github.com/${organizationName}/${projectName}`,
label: 'GitHub',
position: 'right',
},
Expand Down Expand Up @@ -116,7 +116,7 @@ const config: Config = {
},
{
label: 'GitHub',
href: 'https://github.com/facebook/docusaurus',
href: `https://github.com/${organizationName}/${projectName}`,
},
],
},
Expand Down
Loading

0 comments on commit 05ac122

Please sign in to comment.