fix #1745
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: allrules | |
run: | | |
curl -X POST https://api.github.com/repos/ricosjp/allrules/dispatches \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "authorization: token ${{ secrets.DISPATCH_TOKEN }}" \ | |
--data '{"event_type":"from '$GITHUB_REPOSITORY'"}' |