-
Notifications
You must be signed in to change notification settings - Fork 2
193 lines (179 loc) · 5.69 KB
/
refresh_webpage.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Build and Deploy dashboard
on:
push:
branches:
- main
workflow_dispatch:
schedule:
- cron: '0 8 * * *'
jobs:
big_query_update:
runs-on: ubuntu-latest
timeout-minutes: 300
permissions:
contents: 'write'
id-token: 'write'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: create service-secrets.json
run: |
echo "$SERVICE_SECRETS" > service-secrets.json
env:
SERVICE_SECRETS: ${{ secrets.SERVICE_SECRETS }}
- name: Install dependencies
run: |
uv sync
- name: Build the dashboard
run: |
uv run traceback-with-variables napari_dashboard.big_query_update dashboard.db
env:
PEPY_KEY: ${{ secrets.PEPY_KEY }}
GH_TOKEN_: ${{ secrets.GITHUB_TOKEN }}
GOOGLE_APPLICATION_CREDENTIALS: service-secrets.json
ZULIP_API_KEY: ${{ secrets.ZULIP_API_KEY }}
# I'm using GH_TOKEN_ because using GITHUB_TOKEN during development crash gh app
- name: Set zulip message
if: ${{ always() }}
id: set_zulip_message
run: |
if [ "${{ job.status }}" == "success" ]; then
echo "MESSAGE=Google big query finished successful" >> $GITHUB_ENV
else
echo "MESSAGE=Google big query failed" >> $GITHUB_ENV
fi
- name: Send a stream message
if: ${{ always()}}
uses: zulip/github-actions-zulip/send-message@v1
with:
api-key: ${{ secrets.ZULIP_API_KEY }}
email: "[email protected]"
organization-url: "https://napari.zulipchat.com"
to: "metrics and analytics"
type: "stream"
topic: "Google big query download"
content: ${{ env.MESSAGE }}
fetch_api_data:
needs: big_query_update
runs-on: ubuntu-latest
timeout-minutes: 300
permissions:
contents: 'write'
id-token: 'write'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: create service-secrets.json
run: |
echo "$SERVICE_SECRETS" > service-secrets.json
env:
SERVICE_SECRETS: ${{ secrets.SERVICE_SECRETS }}
- name: Install dependencies
run: |
uv sync
- name: Update db from api
run: |
uv run traceback-with-variables napari_dashboard.api_update
env:
PEPY_KEY: ${{ secrets.PEPY_KEY }}
GH_TOKEN_: ${{ secrets.GITHUB_TOKEN }}
# I'm using GH_TOKEN_ because using GITHUB_TOKEN during development crash gh app
- name: Set zulip message
if: ${{ always() }}
id: set_zulip_message
run: |
if [ "${{ job.status }}" == "success" ]; then
echo "MESSAGE=API update successfully" >> $GITHUB_ENV
else
echo "MESSAGE=API update failed" >> $GITHUB_ENV
fi
- name: Send a stream message
if: ${{ always()}}
uses: zulip/github-actions-zulip/send-message@v1
with:
api-key: ${{ secrets.ZULIP_API_KEY }}
email: "[email protected]"
organization-url: "https://napari.zulipchat.com"
to: "metrics and analytics"
type: "stream"
topic: "Deploy dashboard"
content: ${{ env.MESSAGE }}
update_webpage:
needs: fetch_api_data
runs-on: ubuntu-latest
timeout-minutes: 300
permissions:
contents: 'write'
id-token: 'write'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: create service-secrets.json
run: |
echo "$SERVICE_SECRETS" > service-secrets.json
env:
SERVICE_SECRETS: ${{ secrets.SERVICE_SECRETS }}
- name: Install dependencies
run: |
uv sync
- name: Build the dashboard
run: |
uv run traceback-with-variables napari_dashboard.webpage_update
env:
PEPY_KEY: ${{ secrets.PEPY_KEY }}
GH_TOKEN_: ${{ secrets.GITHUB_TOKEN }}
# I'm using GH_TOKEN_ because using GITHUB_TOKEN during development crash gh app
- name: Deploy Dashboard
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./webpage
publish_branch: gh_pages
exclude_assets: 'napari_dashboard.xlsx'
- name: Set zulip message
if: ${{ always() }}
id: set_zulip_message
run: |
if [ "${{ job.status }}" == "success" ]; then
echo "MESSAGE=Dashboard deployed successfully" >> $GITHUB_ENV
else
echo "MESSAGE=Dashboard deployment failed" >> $GITHUB_ENV
fi
- name: Send a stream message
if: ${{ always()}}
uses: zulip/github-actions-zulip/send-message@v1
with:
api-key: ${{ secrets.ZULIP_API_KEY }}
email: "[email protected]"
organization-url: "https://napari.zulipchat.com"
to: "metrics and analytics"
type: "stream"
topic: "Deploy dashboard"
content: ${{ env.MESSAGE }}