Skip to content

Commit

Permalink
ci: publish docs to GitHub Pages with action instead of branch (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
neoncitylights committed Jan 20, 2024
1 parent 55efb80 commit 4a6bd12
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 385 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,28 +85,6 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

docs:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: latest
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build documentation
run: npm run build:typedoc
- name: Deploy documentation
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npm run deploy -- -u "github-actions-bot <support+actions@github.com>"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pkg-dry-run:
runs-on: ubuntu-latest
steps:
Expand All @@ -132,7 +110,6 @@ jobs:
- build
- lint
- test
- docs
- pkg-dry-run
steps:
- name: ✅ CI succeeded
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy TypeDoc site to Pages

on:
push:
branches: [main]
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: latest
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Build documentation
run: npm run docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/typedoc

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ next-env.d.ts
.pnp.*

# TypeDoc
docs/typedocs
docs/typedoc

# Storybook
build-storybook.log
Expand Down
Loading

0 comments on commit 4a6bd12

Please sign in to comment.