Skip to content

Update README.md

Update README.md #70

name: Copy branches main to documentation
env:
REPO_OWNER: hannesdelbeke
# Controls when the action will run.
on:
# Triggers the workflow on push request events but only for the main branch
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
copy-content-to-mkdocs-branch:
runs-on: ubuntu-latest
steps:
# clone the 'mkdocs' branch to the'mkdocs_build_folder' folder
- name: clone the mkdocs build branch
uses: actions/checkout@v2
with:
path: mkdocs_build_folder
ref: mkdocs
# clone the notes to the docs folder
- name: clone the notes to the docs folder
uses: actions/checkout@v2
with:
repository: hannesdelbeke/brain
path: notes_source
# run janitor on markdown input to create backlinks
- uses: actions/setup-node@v2
with:
node-version: '16'
- uses: actions/checkout@v2
with:
repository: 'hannesdelbeke/note-link-janitor' # use fork to support subfolders
ref: stable
path: 'note-link-janitor'
- name: install yarn in janitor workspace
run: |
cd ${{ github.workspace }}/note-link-janitor
yarn install
yarn run build
- name: Run Note Link Janitor
run: ${{ github.workspace }}/note-link-janitor/dist/index.js ${{ github.workspace }}/notes_source
# Clean mkdocs_build_folder/docs before syncing new files.
# prevents duplicate files in case we moved a file.
# - name: clean mkdocs_build_folder/docs
# run: |
# rm -rf mkdocs_build_folder/docs/*
# mkdir -p mkdocs_build_folder/docs/
# first move image, then notes. # docs folder already exists, it contains css in assets
- name: move submodule files to mkdocs_build_folder
run: |
mkdir -p mkdocs_build_folder/docs/images/
mv notes_source/image/* mkdocs_build_folder/docs/images/
rm --force -r notes_source/.git
rsync -av notes_source/* mkdocs_build_folder/docs/
# # push repo
# - name: push updates to mkdocs branch
# # uses: ad-m/github-push-action@master
# # with:
# # directory: mkdocs_build_folder
# run: |
# cd mkdocs_build_folder
# git config --global user.name github-actions
# git config --global user.email github-actions@github.com
# git add .
# git commit -m "copy notes and images"
# git push
- uses: actions/setup-python@v2
with:
python-version: 3.x
- name: install py requirements
run: |
cd mkdocs_build_folder
pip install --requirement requirements.txt
- name: build mkdocs & deploy to github pages
run: |
cd mkdocs_build_folder
mkdocs gh-deploy --force