Skip to content

Commit c8c678a

Browse files
committed
publish safe.hpp to github pages
1 parent e98fa06 commit c8c678a

File tree

2 files changed

+55
-4
lines changed

2 files changed

+55
-4
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish Release Header
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
8+
env:
9+
DEBIAN_FRONTEND: noninteractive
10+
11+
jobs:
12+
build:
13+
runs-on: intel-ubuntu-22.04
14+
15+
steps:
16+
- name: Checkout source
17+
uses: actions/checkout@v4
18+
19+
- name: Build Release Header
20+
run: |
21+
mkdir -p ./generated-hpp
22+
python3 tools/gen_release_header.py include safe.hpp > ./generated-hpp/safe.hpp
23+
24+
- name: Setup github pages
25+
uses: actions/configure-pages@v3
26+
27+
- name: Upload artifacts
28+
uses: actions/upload-pages-artifact@v2
29+
with:
30+
path: ./generated-hpp
31+
32+
deploy:
33+
needs: build
34+
35+
permissions:
36+
contents: read
37+
pages: write
38+
id-token: write
39+
40+
environment:
41+
name: github-pages
42+
url: $${{ steps.deployment.outputs.page_url }}
43+
44+
runs-on: intel-ubuntu-22.04
45+
46+
steps:
47+
- name: Deploy to github pages
48+
id: deployment
49+
uses: actions/deploy-pages@v2

tools/gen_release_header.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
version = os.popen("git describe --tags").read().strip()
1111
visited_includes = set()
12-
root = Path(sys.argv[1]).parent.parent
12+
13+
include_dir = Path(sys.argv[1])
14+
main_header = Path(sys.argv[2])
1315

1416
# store content rather than emit directly
1517
content_lines = []
@@ -18,7 +20,7 @@
1820

1921

2022
def process(base_filepath):
21-
global version, visited_includes, root
23+
global version, visited_includes, include_dir
2224
global content_lines, system_headers, insert_system_headers_line
2325

2426
if base_filepath not in visited_includes:
@@ -33,7 +35,7 @@ def process(base_filepath):
3335
insert_system_headers_line = len(content_lines)
3436

3537
sub_filepath = Path(m.group(1))
36-
full_path = root / sub_filepath
38+
full_path = include_dir / sub_filepath
3739

3840
if full_path.exists():
3941
# recurse into a cib header
@@ -50,7 +52,7 @@ def process(base_filepath):
5052
content_lines.append(line)
5153

5254

53-
process(Path(sys.argv[1]))
55+
process(include_dir / main_header)
5456

5557
# write out the content, when we get to the line number the location to emit
5658
# system headers, write those out before proceeding with the remaining content

0 commit comments

Comments
 (0)