-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (105 loc) · 3.95 KB
/
push-to-artsdata.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
name: Import Google Sheet to Artsdata
on:
workflow_dispatch:
inputs:
spreadsheet_url:
description: 'Google Spreadsheet /export?exportFormat=csv'
type: string
required: true
default: 'https://docs.google.com/spreadsheets/d/1fPcWbdSL-gcLmeGWVCID9TjBq5fGk4vG4HG2E7kSAb0/export?exportFormat=csv'
artifact:
description: 'Artifact'
type: string
required: true
default: 'test-events'
prefix:
description: 'Prefix'
type: string
required: true
default: 'http://test-events/'
jobs:
download-and-transform-data:
runs-on: ubuntu-latest
outputs:
output-file-path: ${{ steps.step-5.outputs.events_file_name }}
container:
image: ontotext/refine:1.2.0
options: --user root
ports:
- 7333:7333
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 Google Sheet
id: step-3
run: |
curl -L ${{inputs.spreadsheet_url}} -o events.csv
- name: Download configuration files for transformation
id: step-4
run: |
curl 'https://raw.githubusercontent.com/culturecreates/artsdata-google-workspace-smart-chip/main/ontorefine/sheet-configuration.json' >> event-transform-config.json
- name: Set prefix in RDF mapping
id: step-4-set-sheet-prefix
run: |
sed -i "s|http://google-sheet/|${{inputs.prefix}}|g" event-transform-config.json
- name: Set output file name
id: step-5
run: |
echo "events_file_name=events-$(uuidgen).ttl" >> $GITHUB_OUTPUT
- name: List files
id: step-6-info
run: |
ls -la
- name: Transform events in CSV to RDF
id: step-6
run: |
/opt/ontorefine/dist/bin/ontorefine-cli \
transform events.csv \
-u http://localhost:7333 \
--configurations event-transform-config.json \
-f csv >> ${{steps.step-5.outputs.events_file_name}}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: events
path: ./${{steps.step-5.outputs.events_file_name}}
retention-days: 1
commit-to-github:
runs-on: ubuntu-latest
needs: download-and-transform-data
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifacts
id: download-step
uses: actions/download-artifact@v2
with:
name: events
path: ./events
- name: Copy files
run: |
mkdir -p outputs
cp /home/runner/work/artsdata-google-workspace-smart-chip/artsdata-google-workspace-smart-chip/events/${{needs.download-and-transform-data.outputs.output-file-path}} ./outputs/${{needs.download-and-transform-data.outputs.output-file-path}}
- name: Commit file to GitHub
run: |
git pull
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add "outputs/${{needs.download-and-transform-data.outputs.output-file-path}}"
git commit -m "Push Event TTL file"
git push
artsdata-push:
runs-on: ubuntu-latest
needs: [commit-to-github, download-and-transform-data]
steps:
- name: Action setup
uses: culturecreates/[email protected]
with:
artifact: ${{inputs.artifact}}
group: google-sheet
publisher: "${{ secrets.PUBLISHER_URI_GREGORY }}"
downloadUrl: https://raw.githubusercontent.com/culturecreates/artsdata-google-workspace-smart-chip/main/outputs/${{needs.download-and-transform-data.outputs.output-file-path}}