docs #573
Workflow file for this run
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: Update docs | |
on: | |
push: | |
branches: | |
- npalm/mkdocs | |
paths: | |
- "**/*.tf" | |
- "**/*.md" | |
- ".github/workflows/update-docs.yml" | |
- "mkdocs.yaml" | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
docs: | |
# update docs after merge back to develop | |
name: Auto update terraform docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout with GITHUB Action token | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4 | |
- name: Generate TF docs (root) | |
uses: terraform-docs/gh-actions@f6d59f89a280fa0a3febf55ef68f146784b20ba0 # ratchet:terraform-docs/gh-actions@v1.0.0 | |
with: | |
git-push: false | |
working-dir: . | |
output-file: main.md | |
- name: Generate TF docs (modules and examples) | |
uses: terraform-docs/gh-actions@f6d59f89a280fa0a3febf55ef68f146784b20ba0 # ratchet:terraform-docs/gh-actions@v1.0.0 | |
with: | |
find-dir: . | |
git-push: false | |
working-dir: modules,examples | |
output-file: README.md | |
- name: copy terraform documentation to docs dir | |
run: | | |
bash .ci/copy-docs.sh | |
- name: Commit and push changes | |
#if: github.ref != 'refs/heads/main' || github.repository_owner != 'philips-labs' | |
run: | | |
sudo chown -R $(id -u):$(id -g) .git/objects | |
git config --global user.name ${{ github.actor }} | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
git status | |
git add --all docs/generated | |
git status | |
git commit -m "docs: auto update terraform docs" . | |
git push | |
git status | |
- name: Create Pull Request (main branch only) | |
if: github.ref == 'refs/heads/main' && github.repository_owner == 'philips-labs' | |
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # ratchet:peter-evans/create-pull-request@v5.0.2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "Update Terraform docs" | |
title: "docs: Update Terraform docs" | |
branch: update-docs | |
branch-suffix: random | |
base: ${{ github.event.pull_request.base.ref }} | |
delete-branch: true | |
deploy-pages: | |
needs: [docs] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure Git Credentials | |
run: | | |
git config user.name github-actions[bot] | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- 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 -c -b npalm/test |