Deploy to GitHub Pages #245
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from https://www.github.com/folke/lazy.nvim | |
name: Deploy to GitHub Pages | |
on: | |
push: | |
branches: | |
- docs | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Generate docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Install Neovim | |
shell: bash | |
run: | | |
mkdir -p /tmp/nvim | |
wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage -O /tmp/nvim/nvim.appimage | |
cd /tmp/nvim | |
chmod a+x ./nvim.appimage | |
./nvim.appimage --appimage-extract | |
echo "/tmp/nvim/squashfs-root/usr/bin/" >> $GITHUB_PATH | |
- name: Run docgen | |
shell: bash | |
run: | | |
nvim -l scripts/docs.lua | |
- name: Copy docs to tmp | |
run: | | |
mkdir -p /tmp/temp-docs | |
ls docs/dev/ | |
cp -r docs/ /tmp/temp-docs/ | |
- name: Checkout docs branch | |
uses: actions/checkout@v4 | |
with: | |
ref: docs | |
- name: Copy docs for building | |
run: | | |
rm -rf docs/* | |
cp -r /tmp/temp-docs/docs/* docs | |
- name: Push changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "chore(build): auto-generate docs" | |
commit_user_name: "github-actions[bot]" | |
commit_user_email: "github-actions[bot]@users.noreply.github.com" | |
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>" | |
docusaurus: | |
name: Build Docusaurus | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: docs | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: pnpm | |
- name: Debug | |
run: | | |
ls docs | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build website | |
run: pnpm build | |
- name: Upload Build Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: build | |
deploy: | |
name: Deploy to GitHub Pages | |
needs: docusaurus | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |