-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (30 loc) · 1001 Bytes
/
deploy-data.yml
File metadata and controls
35 lines (30 loc) · 1001 Bytes
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
name: Data deployment
on:
push:
branches:
- main
jobs:
Build-and-Deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
- name: YAML to JSON
run: |
find data/ -type f | grep -Ei .+\.yml | sed -E 's/(.+)\.yml/\1/' | xargs -I {} npx yaml-convert -j {}.yml -o {}.json
cp README.md data/index.md
cd data/
echo -e "\n## 数据接口 / Data Interface\n" >> index.md
ls -1 *.yml 2>/dev/null | \
sed 's/\.yml$//' | nl | \
sed 's/^[[:space:]]*\([0-9]*\)[[:space:]]*\(.*\)$/\1. [\2](https:\/\/goodaction-hub.github.io\/GoodAction-data\/\2.json)/' >> index.md
cd -
- name: Deploy to GitHub pages
uses: peaceiris/actions-gh-pages@v4
with:
publish_dir: ./data
enable_jekyll: true
personal_token: ${{ github.token }}
force_orphan: true