Skip to content

deploy-github-pages #22

deploy-github-pages

deploy-github-pages #22

name: deploy-github-pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Update Submodule
run: git submodule init && git submodule update --remote
- name: Commit Changes
uses: EndBug/add-and-commit@v7
with:
message: 'chore: update git submodules'
default_author: github_actions
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Switch to Latest Tag
run: cd lib && git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
- name: Copy CHANGELOG.md
run: cp lib/CHANGELOG.md docs/changelog.md
- name: Copy README.md
run: |
rm -rf docs/intro.md
echo "---" >> docs/intro.md
echo "sidebar_position: 1" >> docs/intro.md
echo "title: 'Welcome'" >> docs/intro.md
echo "sidebar_label: 'Welcome'" >> docs/intro.md
echo "slug: /" >> docs/intro.md
echo "---" >> docs/intro.md
cat lib/README.md >> docs/intro.md
- name: Install
run: yarn
- name: Build
run: yarn build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./build
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
publish-github-pages:
needs: generate-docs
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@v2