re-generate files #609
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: re-generate files | |
"on": | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths: | |
- ".github/workflows/gh-pages.yml" | |
- "templates/README.adoc.jinja2" | |
- "all-repos-in.json" | |
- "ansible_roles/*.py" | |
- "ansible_roles_scripts/script_utils.py" | |
- "requirements.txt" | |
- "setup.cfg" | |
- "setup.py" | |
schedule: | |
# At 05:00am | |
- cron: "0 5 * * *" | |
permissions: | |
contents: read | |
jobs: | |
gh-pages: | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: write | |
pages: write | |
steps: | |
- name: check out the codebase | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 | |
with: # https://github.com/stefanzweifel/git-auto-commit-action#checkout-the-correct-branch | |
ref: ${{ github.head_ref }} | |
- name: set up python 3 | |
uses: actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b # v4 | |
with: | |
python-version: "3.x" | |
- name: install graphviz | |
run: sudo apt-get install -y graphviz | |
- name: Install Project from setup.cfg. | |
run: | | |
python3 -m pip install -r requirements.txt | |
python3 -m pip install . | |
- name: Generate Documents from Jinja2 Templates. | |
run: ansible-roles | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate png's from generated dot's. | |
run: | | |
for file in $(ls graphs/*.dot) ; do \ | |
dot "${file}" -Tpng -Nfontname="Open Sans" -Efontname="Open Sans" -Gfontname="Open Sans" -o "${file%.*}".png ; \ | |
dot "${file}" -Tsvg -Nfontname="Open Sans" -Efontname="Open Sans" -Gfontname="Open Sans" -o "${file%.*}".svg ; \ | |
done | |
- name: Commit generated files back to repository. | |
uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a # v4 | |
with: | |
commit_message: "chore: re-generate \n ${{ github.sha }}" | |
file_pattern: "*.adoc *.dot *.png *.svg" | |
- name: setup ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "2.7.0" | |
- name: install asciidoctor | |
run: gem install --no-document asciidoctor rouge coderay | |
- name: Generate HTML of Asciidoctor files to /docs. | |
run: asciidoctor --backend=html5 --destination-dir docs --out-file index.html README.adoc | |
- name: Copy '/graphs' into '/docs' | |
run: cp -rf graphs/ docs/ | |
- name: Deploy /docs to GitHub Pages. | |
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: gh-pages | |
publish_dir: ./docs/ |