Skip to content

build_docs_triggered_by_catapult #149

build_docs_triggered_by_catapult

build_docs_triggered_by_catapult #149

Workflow file for this run

name: Deploy Docs to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows triggering this workflow from another repository
repository_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
# Default to bash
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/checkout@v3
with:
fetch-depth: 1
repository: "ClarifiedSecurity/catapult"
path: "catapult"
token: ${{ secrets.TOKEN_CATAPULT_DOCS }}
- uses: actions/checkout@v3
with:
fetch-depth: 1
repository: "ClarifiedSecurity/catapult-customizer"
path: "catapult-customizer"
token: ${{ secrets.TOKEN_CATAPULT_DOCS }}
- uses: actions/checkout@v3
with:
fetch-depth: 1
repository: "ClarifiedSecurity/nova.core"
path: "nova-core"
token: ${{ secrets.TOKEN_CATAPULT_DOCS }}
- run: rsync -avm --delete --include='*/' --include='*.md' --exclude='*' catapult/docs/ docs/catapult/
- run: rsync -avm --delete --include='*/' --include='*.md' --exclude='*' catapult-customizer/ docs/catapult-customizer/
- run: rsync -avm --delete --include='*/' --include='*.md' --exclude='*' nova-core/nova/core/roles/ docs/nova-core-collection/
- run: find docs/nova-core-collection/ -type f -iname "*.md" -exec sh -c 'dir=$(dirname "$1"); parent=$(dirname "$dir"); base=$(basename "$dir"); mv "$1" "$parent/$base.md" ' sh {} \;
- run: find docs/nova-core-collection/ -type d -depth -empty -exec rmdir {} \;
- run: rm -rf catapult catapult-customizer nova-core
- run: |
git config --global user.name "CatapultBot"
git config --global user.email "catapult@clarifiedsecurity.com"
git add docs
git status
git diff --quiet && git diff --staged --quiet || git commit -m "CatapultBot update docs"
git push -o ci.skip
git status
### mk docs job
docs:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- run: git fetch --all --depth=1 && git pull --all --rebase --depth=1
- uses: actions/setup-python@v4
with:
python-version: 3.x
#- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
#- uses: actions/cache@v3
# with:
# key: mkdocs-material-${{ env.cache_id }}
# path: .cache
# restore-keys: |
# mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force