-
Notifications
You must be signed in to change notification settings - Fork 0
281 lines (251 loc) · 13.1 KB
/
export-culture-mauricie-entities-to-footlight.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
name: Export Culture Mauricie calendar to Artsdata
on:
workflow_dispatch:
schedule:
- cron: "0 5 * * 3" # Run at 1:00 AM ET every Wednesday
jobs:
transform-culture-mauricie-taxonomies:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download taxonomies from Culture-Mauricie
run: curl 'https://api.footlight.io/calendars/culture-mauricie/taxonomies?page=1&limit=200' >> taxonomies.json
- name: Run Python script
run: python ./util/flatten-cms-taxonomies.py taxonomies.json
- name: Upload json into artifact
uses: actions/upload-artifact@v4
with:
name: taxonomies
path: ./flatten-taxonomies.json
retention-days: 1
transform-culture-mauricie-calendar:
runs-on: ubuntu-latest
needs: transform-culture-mauricie-taxonomies
container:
image: ontotext/refine:1.2.1
options: --user root
ports:
- 7333:7333
outputs:
events_file_name: ${{ steps.step-6.outputs.events_file_name }}
places_file_name: ${{ steps.step-6.outputs.places_file_name }}
organizations_file_name: ${{ steps.step-6.outputs.organizations_file_name }}
people_file_name: ${{ steps.step-6.outputs.people_file_name }}
taxonomies_file_name: ${{steps.step-6.outputs.taxonomies_file_name}}
steps:
- name: Install requirements
id: step-1
run: apk update && apk add curl && apk add util-linux
- name: Run Onto Refine server
id: step-2
run: /opt/ontorefine/dist/bin/ontorefine &
- name: Download data from artifact
id: step-3
uses: actions/download-artifact@v4
with:
name: taxonomies
- name: Download data from Culture Mauricie calendar
id: step-4
run: |
curl 'https://api.footlight.io/calendars/culture-mauricie/events?page=1&limit=200' >> events.json &&
curl 'https://api.footlight.io/calendars/culture-mauricie/places?page=1&limit=200' >> places.json &&
curl 'https://api.footlight.io/calendars/culture-mauricie/organizations?page=1&limit=200' >> organizations.json &&
curl 'https://api.footlight.io/calendars/culture-mauricie/people?page=1&limit=200' >> people.json
- name: Download configuration files for transformation
id: step-5
run: |
curl 'https://raw.githubusercontent.com/culturecreates/artsdata-planet-footlight/main/ontotext-refine/cms-events-configuration.json' >> event-transform-config.json &&
curl 'https://raw.githubusercontent.com/culturecreates/artsdata-planet-footlight/main/ontotext-refine/cms-places-configuration.json' >> place-transform-config.json &&
curl 'https://raw.githubusercontent.com/culturecreates/artsdata-planet-footlight/main/ontotext-refine/cms-organizations-configuration.json' >> organization-transform-config.json &&
curl 'https://raw.githubusercontent.com/culturecreates/artsdata-planet-footlight/main/ontotext-refine/cms-people-configuration.json' >> person-transform-config.json
curl 'https://raw.githubusercontent.com/culturecreates/artsdata-planet-footlight/main/ontotext-refine/cms-taxonomies-configuration.json' >> taxonomy-transform-config.json
- name: Set output file names for Culture Mauricie
id: step-6
run: |
echo "events_file_name=culture-mauricie-events-$(uuidgen).ttl" >> $GITHUB_OUTPUT &&
echo "places_file_name=culture-mauricie-places-$(uuidgen).ttl" >> $GITHUB_OUTPUT &&
echo "organizations_file_name=culture-mauricie-organizations-$(uuidgen).ttl" >> $GITHUB_OUTPUT &&
echo "people_file_name=culture-mauricie-people-$(uuidgen).ttl" >> $GITHUB_OUTPUT
echo "taxonomies_file_name"=culture-mauricie-taxonomies-$(uuidgen).ttl >> $GITHUB_OUTPUT
- name: Transform events in JSON to RDF
id: step-7
run: |
/opt/ontorefine/dist/bin/ontorefine-cli \
transform events.json \
-u http://localhost:7333 \
--configurations event-transform-config.json \
-f json >> ${{ steps.step-6.outputs.events_file_name }}
- name: Transform places in JSON to RDF
id: step-8
run: |
/opt/ontorefine/dist/bin/ontorefine-cli \
transform places.json \
-u http://localhost:7333 \
--configurations place-transform-config.json \
-f json >> ${{ steps.step-6.outputs.places_file_name }}
- name: Transform organizations in JSON to RDF
id: step-9
run: |
/opt/ontorefine/dist/bin/ontorefine-cli \
transform organizations.json \
-u http://localhost:7333 \
--configurations organization-transform-config.json \
-f json >> ${{ steps.step-6.outputs.organizations_file_name }}
- name: Transform people in JSON to RDF
id: step-10
run: |
/opt/ontorefine/dist/bin/ontorefine-cli \
transform people.json \
-u http://localhost:7333 \
--configurations person-transform-config.json \
-f json >> ${{ steps.step-6.outputs.people_file_name }}
- name: Transform taxonomies in JSON to RDF
id: step-11
run: |
/opt/ontorefine/dist/bin/ontorefine-cli \
transform '/__w/artsdata-planet-footlight/artsdata-planet-footlight/flatten-taxonomies.json' \
-u http://localhost:7333 \
--configurations taxonomy-transform-config.json \
-f json >> ${{ steps.step-6.outputs.taxonomies_file_name }}
- name: Upload events in RDF to S3
id: step-12
uses: keithweaver/[email protected]
with:
command: cp
source: ${{ steps.step-6.outputs.events_file_name }}
destination: s3://footlight-cms-entities-exported/
aws_access_key_id: ${{ secrets.S3_ACCESS_KEY_ID}}
aws_secret_access_key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
aws_region: ca-central-1
flags: --acl public-read --content-type text/turtle
- name: Upload places in RDF file to S3
id: step-13
uses: keithweaver/[email protected]
with:
command: cp
source: ${{ steps.step-6.outputs.places_file_name }}
destination: s3://footlight-cms-entities-exported/
aws_access_key_id: ${{ secrets.S3_ACCESS_KEY_ID}}
aws_secret_access_key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
aws_region: ca-central-1
flags: --acl public-read --content-type text/turtle
- name: Upload organizations in RDF file to S3
id: step-14
uses: keithweaver/[email protected]
with:
command: cp
source: ${{ steps.step-6.outputs.organizations_file_name }}
destination: s3://footlight-cms-entities-exported/
aws_access_key_id: ${{ secrets.S3_ACCESS_KEY_ID}}
aws_secret_access_key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
aws_region: ca-central-1
flags: --acl public-read --content-type text/turtle
- name: Upload people in RDF file to S3
id: step-15
uses: keithweaver/[email protected]
with:
command: cp
source: ${{ steps.step-6.outputs.people_file_name }}
destination: s3://footlight-cms-entities-exported/
aws_access_key_id: ${{ secrets.S3_ACCESS_KEY_ID}}
aws_secret_access_key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
aws_region: ca-central-1
flags: --acl public-read --content-type text/turtle
- name: Upload txonomy in RDF file to S3
id: step-16
uses: keithweaver/[email protected]
with:
command: cp
source: ${{ steps.step-6.outputs.taxonomies_file_name }}
destination: s3://footlight-cms-entities-exported/
aws_access_key_id: ${{ secrets.S3_ACCESS_KEY_ID}}
aws_secret_access_key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
aws_region: ca-central-1
flags: --acl public-read --content-type text/turtle
import-data-to-artsdata:
needs: transform-culture-mauricie-calendar
runs-on: ubuntu-latest
steps:
- name: Set current date as output
id: step-1
run: echo "dumpdate=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_OUTPUT
- name: Import events to Artsdata
id: step-2
run: |
curl \
-H 'Content-Type: application/json' \
-X POST http://api.artsdata.ca/databus/ \
--data '{ "artifact": "culture-mauricie-cms-events",
"comment": "Events from Culture Mauricie calendar Footlight",
"publisher": "${{ secrets.PUBLISHER_URI_GREGORY }}",
"group": "${{ github.event.repository.name }}",
"version": "${{ steps.step-1.outputs.dumpdate }}",
"downloadUrl": "https://footlight-cms-entities-exported.s3.ca-central-1.amazonaws.com/${{needs.transform-culture-mauricie-calendar.outputs.events_file_name}}",
"downloadFile": "${{needs.transform-culture-mauricie-calendar.outputs.events_file_name}}",
"reportCallbackUrl": "${{inputs.call-back-url}}"
}'
- name: Import places to Artsdata
id: step-3
run: |
curl \
-H 'Content-Type: application/json' \
-X POST http://api.artsdata.ca/databus/ \
--data '{ "artifact": "culture-mauricie-cms-places",
"comment": "Places from Culture Mauricie calendar Footlight",
"publisher": "${{ secrets.PUBLISHER_URI_GREGORY }}",
"group": "${{ github.event.repository.name }}",
"version": "${{ steps.step-1.outputs.dumpdate }}",
"downloadUrl": "https://footlight-cms-entities-exported.s3.ca-central-1.amazonaws.com/${{needs.transform-culture-mauricie-calendar.outputs.places_file_name}}",
"downloadFile": "${{needs.transform-culture-mauricie-calendar.outputs.places_file_name}}",
"reportCallbackUrl": "https://webhook.site/be245341-5a1b-44cd-896f-590003162b07"
}'
- name: Import organizations to Artsdata
id: step-4
run: |
curl \
-H 'Content-Type: application/json' \
-X POST http://api.artsdata.ca/databus/ \
--data '{ "artifact": "culture-mauricie-cms-organizations",
"comment": "Organizations from Culture Mauricie calendar Footlight",
"publisher": "${{ secrets.PUBLISHER_URI_GREGORY }}",
"group": "${{ github.event.repository.name }}",
"version": "${{ steps.step-1.outputs.dumpdate }}",
"downloadUrl": "https://footlight-cms-entities-exported.s3.ca-central-1.amazonaws.com/${{needs.transform-culture-mauricie-calendar.outputs.organizations_file_name}}",
"downloadFile": "${{needs.transform-culture-mauricie-calendar.outputs.organizations_file_name}}",
"reportCallbackUrl": "https://webhook.site/be245341-5a1b-44cd-896f-590003162b07"
}'
- name: Import people to Artsdata
id: step-5
run: |
curl \
-H 'Content-Type: application/json' \
-X POST http://api.artsdata.ca/databus/ \
--data '{ "artifact": "culture-mauricie-cms-people",
"comment": "People from Culture Mauricie calendar Footlight",
"publisher": "${{ secrets.PUBLISHER_URI_GREGORY }}",
"group": "${{ github.event.repository.name }}",
"version": "${{ steps.step-1.outputs.dumpdate }}",
"downloadUrl": "https://footlight-cms-entities-exported.s3.ca-central-1.amazonaws.com/${{needs.transform-culture-mauricie-calendar.outputs.people_file_name}}",
"downloadFile": "${{needs.transform-culture-mauricie-calendar.outputs.people_file_name}}",
"reportCallbackUrl": "https://webhook.site/be245341-5a1b-44cd-896f-590003162b07"
}'
- name: Import taxonomies to Artsdata
id: step-6
run: |
curl \
-H 'Content-Type: application/json' \
-X POST http://api.artsdata.ca/databus/ \
--data '{ "artifact": "culture-mauricie-cms-taxonomy",
"comment": "Taxonomies from Culture Mauricie calendar Footlight",
"publisher": "${{ secrets.PUBLISHER_URI_GREGORY }}",
"group": "${{ github.event.repository.name }}",
"version": "${{ steps.step-1.outputs.dumpdate }}",
"downloadUrl": "https://footlight-cms-entities-exported.s3.ca-central-1.amazonaws.com/${{needs.transform-culture-mauricie-calendar.outputs.taxonomies_file_name}}",
"downloadFile": "${{needs.transform-culture-mauricie-calendar.outputs.taxonomies_file_name}}",
"reportCallbackUrl": "https://webhook.site/be245341-5a1b-44cd-896f-590003162b07"
}'