Skip to content

Commit

Permalink
Setup CI for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
nt0xa committed Jul 28, 2024
1 parent 6914784 commit d139ce8
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 11 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy docs to GitHub Pages

on:
push:
branches:
- '*' # for test

defaults:
run:
working-directory: ./docs

jobs:
build:
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build website
run: yarn build

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: build

deploy:
name: Deploy to GitHub Pages
needs: build

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy docs to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
30 changes: 30 additions & 0 deletions .github/workflows/test-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test docs deployment

on:
pull_request:
branches:
- master

defaults:
run:
working-directory: ./docs

jobs:
test-deploy:
name: Test docs deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Test build website
run: yarn build
13 changes: 2 additions & 11 deletions docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,15 @@ const config: Config = {
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://nt0xa.github.io",
baseUrl: "/sonar/",

// GitHub pages deployment config.
organizationName: "nt0xa",
projectName: "sonar",

onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",

// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
Expand All @@ -35,8 +28,6 @@ const config: Config = {
docs: {
routeBasePath: "/",
sidebarPath: "./sidebars.ts",
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: "https://github.com/nt0xa/sonar/tree/master/docs/",
},
blog: false,
Expand Down

0 comments on commit d139ce8

Please sign in to comment.