Dendron workspace sync #1067
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: | |
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: 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: Initialize or pull nextjs template | |
run: "(test -d .next) && (echo 'updating dendron next...' && cd .next && git reset --hard && git clean -f && git pull && yarn && cd ..) || (echo 'init dendron next' && yarn dendron publish init)" | |
- 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: example.com |