1+ name : pages.yml
2+ on :
3+ push :
4+ branches :
5+ - " main_protected"
6+
7+ workflow_dispatch :
8+
9+ permissions :
10+ contents : read
11+ pages : write
12+ id-token : write
13+
14+ concurrency :
15+ group : " pages"
16+ cancel-in-progress : false
17+
18+ jobs :
19+ build :
20+ name : " Generate pages"
21+ runs-on : " ubuntu-22.04"
22+
23+ environment :
24+ name : github-pages
25+ url : ${{ steps.deployment.outputs.page_url }}
26+
27+ steps :
28+ - uses : actions/checkout@v4
29+
30+ - name : Setup Pages
31+ uses : actions/configure-pages@v5
32+
33+ - name : Disable man-db auto-update
34+ run : sudo rm -f /var/lib/man-db/auto-update
35+
36+ - name : Generate skeleton
37+ run : |
38+ mkdir -p _site
39+ cat << EOF > _site/index.html
40+ <!DOCTYPE html>
41+ <meta charset=utf-8>
42+ <title>Redirecting...</title>
43+ <link rel=canonical href="./icd/">
44+ <meta http-equiv=refresh content="0; url=./icd/">
45+ EOF
46+
47+ mkdir -p _site/icd
48+
49+ - name : Download & install xidel
50+ working-directory : ${{ runner.temp }}
51+ run : |
52+ wget "https://sourceforge.net/projects/videlibri/files/Xidel/Xidel%20development/xidel_0.9.9-1_amd64.deb/download" -O xidel.deb
53+ sudo apt install ./xidel.deb
54+
55+ - name : Download & install asn1scc
56+ working-directory : ${{ runner.temp }}
57+ run : |
58+ wget "https://github.com/scsd-cdh/asn1scc/releases/latest/download/asn1scc.linux.x86_64.zip" -O asn1scc.zip
59+ unzip -d asn1scc asn1scc.zip
60+
61+ - name : Generate ICDs
62+ run : |
63+ cat << EOF > _site/icd/index.html
64+ <html>
65+ <head>
66+ <title>CDH ICDs</title>
67+ </head>
68+ <body>
69+ <ul>
70+ EOF
71+
72+ for file in APP/_asn1/*.asn1; do
73+ echo "${file}"
74+ file_html="_site/icd/$(basename "${file%.asn1}.html")"
75+
76+ cat << EOF >> _site/icd/index.html
77+ <li><a href="./${file_html}">${file}</a></li>
78+ EOF
79+
80+ ${{ runner.temp }}/asn1scc/asn1scc --icdacn "${file_html}" "${file}"
81+
82+ selector='x:replace-nodes(//table[.//css(".typeRow")][.//i[text()="anonymous "]]'
83+ timeout 15s bash -c "until wxidel --html \"${file_html}\" -e '${selector}"'/following-sibling::br | '"${selector}"', ())'"' --output-format=html > ~/temp_xidel.html; do sleep 0.1; done"
84+ if [[ -f ~/temp_xidel.html && -s ~/temp_xidel.html ]]; then
85+ mv ~/temp_xidel.html "${file_html}"
86+ fi
87+
88+ done
89+
90+ cat << EOF >> _site/icd/index.html
91+ </ul>
92+ </body>
93+ </html>
94+ EOF
95+
96+ - name : Upload artifact
97+ uses : actions/upload-pages-artifact@v3
98+ with :
99+ path : ' _site'
100+
101+ - name : Deploy to GitHub Pages
102+ id : deployment
103+ uses : actions/deploy-pages@v4
0 commit comments