@@ -11,14 +11,14 @@ jobs:
1111 outputs :
1212 sanityCheck : ${{ steps.sanity_check.outputs.message }}
1313 steps :
14- - uses : actions/checkout@v3
14+ - uses : actions/checkout@v5
1515 with :
1616 token : ${{ secrets.RMG_BUILD_AND_RELEASE }}
1717 fetch-depth : 0 # Fetch all to get authors of every template.
1818
1919 - uses : actions/setup-node@v4
2020 with :
21- node-version : ' 20 '
21+ node-version : ' 24 '
2222
2323 - run : npm ci
2424 working-directory : scripts
4747 - name : Install Noto CJK fonts
4848 run : sudo apt install -y fonts-noto-cjk
4949
50- - name : Make metadata and images
50+ - name : Make metadata and SVG
5151 run : node --loader ts-node/esm ./issuebot.ts
5252 working-directory : scripts
5353 env :
5757 USER_ID : ${{ github.event.issue.user.id }}
5858 id : bot
5959
60+ - name : Download resvg
61+ run : |
62+ wget https://github.com/linebender/resvg/releases/download/v0.45.1/resvg-linux-x86_64.tar.gz
63+ tar -xzf resvg-linux-x86_64.tar.gz
64+ chmod +x resvg
65+ working-directory : scripts
66+
67+ - name : Clone RMP
68+ uses : actions/checkout@v5
69+ with :
70+ token : ${{ secrets.RMG_BUILD_AND_RELEASE }}
71+ repository : railmapgen/rmp
72+ path : rmp
73+
74+ - name : Clone RMT
75+ uses : actions/checkout@v5
76+ with :
77+ token : ${{ secrets.RMG_BUILD_AND_RELEASE }}
78+ repository : railmapgen/railmapgen.github.io
79+ path : rmt
80+
81+ - name : Copy fonts
82+ run : |
83+ mkdir -p fonts
84+ ls ../rmp/public/fonts/
85+ ls ../rmt/public/fonts/
86+ cp -r ../rmp/public/fonts/* ./fonts/
87+ cp ../rmt/public/fonts/*.ttf ./fonts/
88+ tree /usr/share/fonts
89+ echo "Copy system Noto CJK fonts for fallback"
90+ sudo find /usr/share/fonts -name "NotoSans*.ttf" -o -name "NotoSansCJK*.ttc" -o -name "NotoSerif*.ttf" -o -name "NotoSerifCJK*.ttc" | xargs -I {} sudo cp {} ./fonts/ || true
91+ ls fonts/
92+ working-directory : scripts
93+
94+ - name : Convert SVG to PNG using resvg
95+ run : |
96+ SVG_FILE=$(ls $HOME/Downloads/RMP_*.svg | head -n 1)
97+ CITY_NAME=$(basename "$SVG_FILE" .svg | sed 's/RMP_//')
98+ ./resvg --skip-system-fonts --use-fonts-dir fonts --list-fonts
99+ ./resvg --skip-system-fonts --use-fonts-dir fonts --sans-serif-family "Noto Sans CJK SC" --background white -z 2 "$SVG_FILE" "$HOME/Downloads/${CITY_NAME}.png"
100+ cp "$HOME/Downloads/${CITY_NAME}.png" ../public/resources/thumbnails/
101+ working-directory : scripts
102+
103+ - name : Generate thumbnail
104+ run : node --loader ts-node/esm ./make-thumbnail.ts
105+ working-directory : scripts
106+
60107 - name : Make logins
61108 run : |
62109 node ./loginbot.js
0 commit comments