Skip to content

Update copy-to-documentation-branch.yml #62

Update copy-to-documentation-branch.yml

Update copy-to-documentation-branch.yml #62

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'dst_repo' folder
- name: checkout target repo (branch)
uses: actions/checkout@v2
with:
path: dst_repo
ref: mkdocs
# load content files in submodule in the docs folder
- name: load submodule
uses: actions/checkout@v2
with:
repository: hannesdelbeke/brain
path: temp_submodule
# run janitor on markdown input
- 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 }}/temp_submodule
# Clean dst_repo/docs before syncing new files.
# prevents duplicate files in case we moved a file.
- name: clean dst_repo/docs
run: |
rm -rf dst_repo/docs/*
mkdir -p dst_repo/docs/
# first move image, then notes. # docs folder already exists, it contains css in assets
- name: move submodule files to dst_repo
run: |
mkdir -p dst_repo/static/images/
mv temp_submodule/image/* dst_repo/static/images/
rm --force -r temp_submodule/.git
rsync -av temp_submodule/* dst_repo/docs/
# # push repo
# - name: push updates to mkdocs branch
# # uses: ad-m/github-push-action@master
# # with:
# # directory: dst_repo
# run: |
# cd dst_repo
# 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 dst_repo
pip install --requirement requirements.txt
- name: build mkdocs & deploy to github pages
run: |
cd dst_repo
mkdocs gh-deploy --force