-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (68 loc) · 2.45 KB
/
update_md.yaml
File metadata and controls
81 lines (68 loc) · 2.45 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
name: Update ICPSR Markdown
on:
push:
branches-ignore:
- main
- gh-pages
paths:
- 'schema/**'
- 'rde_schema/**'
- 'markdown/**'
jobs:
update_markdown:
runs-on: ubuntu-latest
name: Update Markdown
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Get changed files in schema folder
id: changed-schema
uses: tj-actions/changed-files@v47
with:
files: schema/**
- name: Get changed files in rde_schema folder
id: changed-rde
uses: tj-actions/changed-files@v47
with:
files: rde_schema/**
- name: Get changed files in markdown folder
id: changed-markdown
uses: tj-actions/changed-files@v47
with:
files: markdown/**
- name: Prevent running if no relevant files changed
if: steps.changed-schema.outputs.any_changed != 'true' && steps.changed-rde.outputs.any_changed != 'true'
run: echo "No relevant changes detected"
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.11
- name: Install dependencies
run: |
pip install -r resources/requirements.txt
- name: Generate Legacy Schema Documentation
if: steps.changed-schema.outputs.any_changed == 'true' || steps.changed-markdown.outputs.any_changed == 'true'
run: |
python resources/generate_markdown.py \
--input $GITHUB_WORKSPACE \
--mode legacy
- name: Generate Current Schema Documentation
if: steps.changed-rde.outputs.any_changed == 'true' || steps.changed-markdown.outputs.any_changed == 'true'
run: |
python resources/generate_markdown.py \
--input $GITHUB_WORKSPACE \
--mode current
- name: Commit and push changes
run: |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config user.name "${GITHUB_ACTOR}"
git add markdown/
git diff --cached --quiet || git commit -m "Generated new copy of schema in markdown"
git push origin HEAD:$GITHUB_REF
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site