-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (121 loc) · 4.13 KB
/
main.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: main
on:
push:
branches:
- main
repository_dispatch:
jobs:
build:
runs-on: ubuntu-latest
container:
image: texlive/texlive
steps:
- name: libfaketime
run: |
apt-get update && apt-get -y install gcc jq
git clone https://github.com/wolfcw/libfaketime.git
cd libfaketime/src && make install
cd - && rm -fr libfaketime
- name: Articles
uses: actions/checkout@v3
with:
repository: ricosjp/Articles
path: Articles
- name: WorkRules
uses: actions/checkout@v3
with:
repository: ricosjp/WorkRules
path: WorkRules
- name: organization
uses: actions/checkout@v3
with:
repository: ricosjp/rules_organization
path: organization
- name: research
uses: actions/checkout@v3
with:
repository: ricosjp/rules_research
path: research
- name: safety
uses: actions/checkout@v3
with:
repository: ricosjp/rules_safety
path: safety
- name: build
run: |
export LD_PRELOAD=/usr/local/lib/faketime/libfaketime.so.1
export TZ=Asia/Tokyo
for d in */ ; do
mkdir -p ./public/$d
cd $d
find . -type f |xargs sed -z "s/%CERTIFICATION.*FIELD%//" -i
FAKETIME=$(git log --date=iso --date=iso-local --pretty=format:"%ad" -1) make -j
find . -name '*.pdf' -maxdepth 2 | xargs -I% mv % ../public/$d
cd -
for name in `ls public/$d`; do echo "<a href=./$name>$name</a><br>" >> public/$d/index.html; echo "$name" >> public/$d/list.txt; done
done
- name: index
run: |
cd public
echo { >> files.json
for d in $(ls -d */|sed 's/\///g'|sort); do
repo=$(find ../$d -name "README.md"|xargs grep ^#|head -n1|sed -e 's/#[ ]*//')
repo=$(echo $repo|sed -e 's/^[ ]*//')
echo "## " $repo >> index.md
echo "$d:" >> files.yaml
echo " name: $repo" >> files.yaml
echo " path: $d" >> files.yaml
echo " data:" >> files.yaml
echo '"'$d'"': {'"'name'"':'"'$repo'"','"'path'"':'"'$d'"','"'data'"':{ >> files.json
for path in $(find $d -name '*.pdf'|sort); do
name=$(find ../$d -name "$(basename $path .pdf)*"|xargs grep \title{| sed -e "s/^.*{\(.*\)}.*$/\1/" -e 's/\\\\/ /')
name=$(echo $name|sed -e 's/^[ ]*//')
bpath=$(basename $path)
echo "- [$name]($path)" >> index.md
echo " $name:" >> files.yaml
echo " name: $name" >> files.yaml
echo " path: $bpath">> files.yaml
echo '"'$name'"':{'"name":''"'$name'"', '"path":''"'$bpath'"'}, >> files.json
done
sed -i -e '$ s/,$/}},/' files.json
echo >> index.md
done
sed -i -e '$ s/,$/}/' files.json
cat files.json | jq -c > files2.json
mv files2.json files.json
- name: Rules
uses: actions/checkout@v3
with:
path: rules
- name: copy
run: |
cat ./public/index.md >> ./rules/index.md
cp -uprv ./rules/* ./public/
- uses: actions/jekyll-build-pages@v1
with:
source: "./public"
destination: "./output"
- uses: actions/upload-pages-artifact@v1
with:
path: ./output
deploy:
needs: build
permissions:
id-token: write
pages: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
steps:
- uses: actions/deploy-pages@v2
id: deployment
dispatch:
runs-on: ubuntu-latest
steps:
- name: regulations
run: |
curl -X POST https://api.github.com/repos/ricosjp/regulations/dispatches \
-H "Accept: application/vnd.github.v3+json" \
-H "authorization: token ${{ secrets.DISPATCH_TOKEN }}" \
--data '{"event_type":"from '$GITHUB_REPOSITORY'"}'