Flow sync-documentation pipeline #4
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: Flow sync-docs pipeline | |
on: | |
# To create the button that runs a workflow manually: | |
workflow_dispatch: | |
jobs: | |
update-docs: | |
runs-on: ubuntu-latest | |
steps: | |
# Write access is required later, so at least 1 way to allow it is under Settings/Actions/General | |
# set "Workflow permissions" to "Read and write permissions" (may need similar org-wide change first). | |
- name: Checkout Pages repo (the destination) | |
uses: actions/checkout@v4 | |
with: | |
path: 'dst_repo' | |
- name: Checkout Code repo (the source) | |
uses: actions/checkout@v4 | |
with: | |
repository: 'Flow-IPC/flow' | |
path: 'src_repo' | |
- name: Replace Pages (destination) docs with copy of Code (source) docs | |
run: | | |
cd dst_repo | |
DOC_DIR=doc/versions | |
BRANCH=main | |
rm -rf $DOC_DIR/$BRANCH | |
mkdir -p $DOC_DIR | |
cp -r ../src_repo/doc/flow_doc $DOC_DIR/$BRANCH | |
# These values informally recommended in: | |
# https://github.com/actions/checkout#push-a-commit-using-the-built-in-token | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git rm -r --cached $DOC_DIR/$BRANCH || echo "No [$DOC_DIR/$BRANCH] currently checked in; no problem." | |
git add $DOC_DIR/$BRANCH | |
git commit -m 'Sync documentation from code repo to Pages repo.' | |
git push origin main |