-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (102 loc) · 3.1 KB
/
ci.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: List public probability models
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
# Run daily at 0:01 UTC
schedule:
- cron: '1 0 * * *'
jobs:
list_models:
runs-on: ubuntu-latest
strategy:
matrix:
kind:
- atlas
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python dependencies
run: |
python -m venv venv
. venv/bin/activate
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r ${{ matrix.kind }}/requirements.txt
- name: Generate list of models
run: |
. venv/bin/activate
python ${{ matrix.kind }}/main.py > ${{ matrix.kind }}.json
- name: Check valid JSON
run: jq -reM '""' ${{ matrix.kind }}.json
- name: cat models file to stdout
run: cat ${{ matrix.kind }}.json
- name: Upload generated list
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.kind }}
path: ${{ matrix.kind }}.json
prepare_website:
runs-on: ubuntu-latest
needs: list_models
steps:
- name: Set up Git repository
uses: actions/checkout@v4
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts/
- name: List artifacts
run: ls -R
working-directory: artifacts
- name: Move to deploy directory
run: |
find artifacts -name "*.json" -print0 | xargs -0 -I file mv "file" deploy/
- name: Make landing page
run: >-
find deploy -name "*.json" -type f -exec basename --zero {} \;
| xargs -0 -I file printf '<li><a href="file">file</a></li>\n'
| xargs -I INSERTED sed -e 's|\$links|INSERTED|' templates/index.html
> deploy/index.html
- name: List contents
run: ls -R
working-directory: deploy
- name: Check landing page contents
run: cat deploy/index.html
- name: Fix permissions
run: |
chmod -c -R +rX "deploy/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload artifacts
uses: actions/upload-pages-artifact@v2
with:
path: deploy/
deploy:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: prepare_website
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3