flow-ipc-sync-doc-event #1
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-IPC sync-documentation pipeline | |
on: | |
# An API request can trigger us; so Code (source) repo can invoke us after generating docs and checking those | |
# in to itself. | |
repository_dispatch: | |
types: [flow-ipc-sync-doc-event] | |
# To create the button that runs a workflow manually: | |
workflow_dispatch: | |
jobs: | |
update-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Pages repo (the destination) | |
uses: actions/checkout@v4 | |
with: | |
path: 'dst_repo' | |
sparse-checkout: 'doc/flow-ipc/versions' | |
- name: Checkout Code repo (the source) | |
uses: actions/checkout@v4 | |
with: | |
repository: 'Flow-IPC/ipc' | |
path: 'src_repo' | |
sparse-checkout: 'doc/ipc_doc' | |
- name: Replace Pages (destination) docs with copy of Code (source) docs | |
run: | | |
# Replace Pages (destination) docs with copy of Code (source) docs. | |
cd dst_repo | |
DOC_DIR=doc/flow-ipc/versions | |
BRANCH=main | |
rm -rf $DOC_DIR/$BRANCH | |
mkdir -p $DOC_DIR | |
cp -r ../src_repo/doc/ipc_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 |