Deploy to GitHub Pages #136
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
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: docs | |
- 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: Generate docs | |
run: ./build.sh | |
- name: panvimdoc | |
uses: kdheepak/panvimdoc@main | |
with: | |
vimdoc: lazy.nvim | |
version: "Neovim >= 0.8.0" | |
description: "A modern plugin manager for Neovim" | |
pandoc: "README.vim.md" | |
demojify: false | |
treesitter: true | |
- 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>" | |
sync-docs: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout docs branch | |
uses: actions/checkout@v4 | |
with: | |
ref: docs | |
- name: Copy docs and README.md | |
run: | | |
mkdir -p /tmp/temp-docs | |
cp -r doc/ /tmp/temp-docs/ | |
cp README.md /tmp/temp-docs/ | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Copy to main branch | |
run: | | |
cp -r /tmp/temp-docs/doc/ . | |
cp /tmp/temp-docs/README.md . | |
- 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: 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 |