-
Notifications
You must be signed in to change notification settings - Fork 6
87 lines (77 loc) · 2.53 KB
/
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
86
87
---
name: Docs
on:
pull_request:
push:
branches:
- master
jobs:
check_files_changed:
runs-on: ubuntu-latest
# Required permissions
permissions:
contents: 'read'
pull-requests: 'read'
outputs:
readme: ${{ steps.filter.outputs.readme }}
docs_command_line_help: ${{ steps.filter.outputs.docs_command_line_help }}
docs_edge_apps: ${{ steps.filter.outputs.docs_edge_apps }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
list-files: shell
filters: |
readme:
- modified: 'README.md'
docs_command_line_help:
- modified: 'docs/CommandLineHelp.md'
docs_edge_apps:
- modified: 'docs/EdgeApps.md'
docs-help-md:
permissions:
contents: write
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
- name: Generate documentation
run: cargo run -- print-help-markdown > /tmp/CommandLineHelp.md
- name: Compare documentation
run: |
diff_output=$(diff /tmp/CommandLineHelp.md docs/CommandLineHelp.md || true)
if [ -n "$diff_output" ]; then
echo "$diff_output"
echo "::error::Documentation is out of date. Please run 'cargo run -- print-help-markdown > docs/CommandLineHelp.md' and commit the changes."
exit 1
else
echo "Documentation is up to date."
fi
trigger-developer-portal-deploy:
if: (github.event_name == 'push') &&
(github.ref == 'refs/heads/master') &&
(
(needs.check_files_changed.outputs.readme == 'true') ||
(needs.check_files_changed.outputs.docs_command_line_help == 'true') ||
(needs.check_files_changed.outputs.docs_edge_apps == 'true')
)
runs-on: ubuntu-latest
needs:
- check_files_changed
- docs-help-md
steps:
- name: Trigger Developer Portal deploy workflow
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.DEVELOPER_PORTAL_REPO_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-d '{"event_type": "deploy"}' \
https://api.github.com/repos/Screenly/developer-portal/dispatches