-
Notifications
You must be signed in to change notification settings - Fork 1
154 lines (138 loc) · 4.53 KB
/
3-build-website.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Build website
on:
workflow_run:
workflows: ["Execute algorithm and evaluate metrics"]
branches: [main]
types:
- completed
push:
branches: [ "main" ]
paths:
- 'website/**'
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
# Default to bash
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Download results
run: |
aws s3 sync s3://${AWS_BUCKET}/results/ ./results
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
AWS_BUCKET: ${{secrets.AWS_BUCKET }}
- name: Concatenate JSONs
run: |
result="./results.json"
echo "{}" > "$result"
for algorithm_dir in ./results/*/; do
algorithm_name=$(basename "$algorithm_dir")
algorithm_obj="{}"
for dataset_file in "$algorithm_dir"*.json; do
dataset_name=$(basename "$dataset_file" .json)
algorithm_obj=$(jq --arg dataset_name "$dataset_name" \
--argjson dataset_content "$(cat "$dataset_file")" \
'. + {($dataset_name): $dataset_content}' <<< "$algorithm_obj")
done
jq --arg algorithm_name "$algorithm_name" \
--argjson algorithm_obj "$algorithm_obj" \
'. + {($algorithm_name): $algorithm_obj}' <<< "$(<"$result")" > "$result"
done
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: results
path: ./results.json
build-hugo:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.139.0
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.139.0'
# extended: true
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install Node packages
run: |
cd website/themes/blowfish
npm ci
- name: Build TailwindCSS
run: |
cd website
mkdir -p ./assets/css/
mv tailwind.config.js ./themes/blowfish/tailwind.config.js
./themes/blowfish/node_modules/tailwindcss/lib/cli.js -c ./themes/blowfish/tailwind.config.js -i ./themes/blowfish/assets/css/main.css -o ./assets/css/compiled/main.css --jit
- name: Build Hugo
run: |
cd website
hugo --minify
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: hugo
path: website/public/
deploy:
needs: [build, build-hugo]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Hugo project
uses: actions/download-artifact@v4
with:
name: hugo
path: website/public/
- name: Download results.json
uses: actions/download-artifact@v4
with:
name: results
path: website/public/
- name: Copy algorithms
run: |
cp -r ./algorithms website/public/algorithms
- name: Rename algorithms
run: |
for algo in website/public/algorithms/*; do
IMAGE=$(grep '^image: ' $algo | sed 's/^image: \+//' | tr -d \'\")
ALGO_NAME=$(echo "$IMAGE" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z)
mv $algo website/public/algorithms/$ALGO_NAME.yaml
done
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'website/public'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4