-
Notifications
You must be signed in to change notification settings - Fork 630
85 lines (78 loc) · 3.25 KB
/
update-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Update docs
on:
push:
paths:
- "**/*.tf"
- "**/*.md"
- ".github/workflows/update-docs.yml"
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:
- uses: philips-software/app-token-action@9f5d57062c9f2beaffafaa9a34f66f824ead63a9 # v2.0.0
id: app
with:
app_id: ${{ vars.FOREST_PR_BOT_APP_ID }}
app_base64_private_key: ${{ secrets.FOREST_PR_BOT_APP_KEY_BASE64 }}
auth_type: installation
org: philips-labs
- name: Checkout with GITHUB Action token
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # ratchet:actions/checkout@v4
with:
token: ${{ steps.app.outputs.token }}
# use an app to ensure CI is triggered
- name: Generate TF docs
if: github.repository_owner == 'philips-labs'
uses: terraform-docs/gh-actions@e47bfa196e79fa50987ef391be236d9d97b0c786 # ratchet:terraform-docs/[email protected]
with:
find-dir: .
git-commit-message: "docs: auto update terraform docs"
git-push: ${{ github.ref != 'refs/heads/main' || github.repository_owner != 'philips-labs' }}
git-push-user-name: forest-pr|bot
git-push-user-email: "forest-pr[bot]@users.noreply.github.com"
- name: Generate TF docs (forks)
if: github.repository_owner != 'philips-labs'
uses: terraform-docs/gh-actions@e47bfa196e79fa50987ef391be236d9d97b0c786 # ratchet:terraform-docs/[email protected]
with:
find-dir: .
git-commit-message: "docs: auto update terraform docs"
git-push: ${{ github.ref != 'refs/heads/main' || github.repository_owner != 'philips-labs' }}
# change docs via PR in case of locked main branch
- name: Create Pull Request (main branch only)
if: github.ref == 'refs/heads/main' && github.repository_owner == 'philips-labs'
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # ratchet:peter-evans/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "docs: auto 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@692973e3d937129bcbf40652eb9f2f61becf3332 # ratchet: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@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: pip install mkdocs-material-extensions
- run: mkdocs gh-deploy --force -c -b gh-pages