Nov 24, 2024, 2:54 PM #521
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: Build Dendron Static Site | |
on: | |
workflow_dispatch: # Enables on-demand/manual triggering | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Restore Node modules cache | |
uses: actions/cache@v2 | |
id: node-modules-cache | |
with: | |
path: | | |
node_modules | |
.next/* | |
!.next/.next/cache | |
!.next/.env.* | |
key: ${{ runner.os }}-dendronv2-${{ hashFiles('**/yarn.lock', '**/package-lock.json') }} | |
- name: Install dependencies | |
run: yarn | |
- name: Initialize or pull nextjs template | |
run: "(test -d .next) && (echo 'updating dendron next...' && cd .next && git reset --hard && git pull && yarn && cd ..) || (echo 'init dendron next' && yarn dendron publish init)" | |
- name: Restore Next cache | |
uses: actions/cache@v2 | |
with: | |
path: .next/.next/cache | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('.next/yarn.lock', '.next/package-lock.json') }}-${{ hashFiles('.next/**.[jt]s', '.next/**.[jt]sx') }} | |
- name: Convert less to custom css | |
run: npx @emeks/antd-custom-theme-generator assets/theme.less custom.css | |
- name: Export notes | |
run: yarn dendron publish export --target github --yes | |
- name: Deploy site | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: pages | |
publish_dir: docs/ | |
force_orphan: true | |
cname: notes.hellbhoy.net |