forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish-docs.yml
More file actions
83 lines (72 loc) 路 2.42 KB
/
Copy pathpublish-docs.yml
File metadata and controls
83 lines (72 loc) 路 2.42 KB
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
name: Publish Infrastructure Documentation
on:
push:
branches: [main]
paths:
- 'infrastructure/docs/**'
- 'infrastructure/terraform/**/*.tf'
pull_request:
paths:
- 'infrastructure/docs/**'
jobs:
validate-links:
name: Validate documentation links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install lychee link checker
run: |
curl -sSLo lychee.tar.gz \
"https://github.com/lycheeverse/lychee/releases/download/v0.15.1/lychee-v0.15.1-x86_64-unknown-linux-gnu.tar.gz"
tar -xzf lychee.tar.gz lychee
chmod +x lychee && sudo mv lychee /usr/local/bin/
- name: Check links
run: |
chmod +x infrastructure/scripts/validate-links.sh
bash infrastructure/scripts/validate-links.sh
build-and-publish:
name: Build and publish docs
runs-on: ubuntu-latest
needs: validate-links
if: github.ref == 'refs/heads/main'
permissions:
contents: write
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Setup Python (mkdocs)
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install mkdocs
run: pip install mkdocs-material==9.5.17 mkdocs-git-revision-date-localized-plugin
- name: Build docs
run: mkdocs build --config-file infrastructure/docs/mkdocs.yml --site-dir /tmp/site
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: /tmp/site
destination_dir: infra-docs
deploy-preview:
name: PR deploy preview
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- run: pip install mkdocs-material==9.5.17
- name: Build preview
run: mkdocs build --config-file infrastructure/docs/mkdocs.yml --site-dir /tmp/preview
- name: Comment preview link
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '馃摉 **Docs preview**: Documentation built successfully for this PR. Merge to publish.'
});