-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
73 lines (63 loc) · 2.43 KB
/
Taskfile.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
version: '3'
vars:
INTEGRATION_GRAPH_IRI: http://aksw.org/
WORKING_DIRECTORY: '{{.github.workspace | default .PWD}}'
CMEMC_VERSION: v22.2
CMEMC_IMAGE: docker-registry.eccenca.com/eccenca-cmemc:{{.CMEMC_VERSION}}
CMEMC_CONFIG: cmemc.ini
CMEMC_CONFIG_ID: aksw.eccenca.dev
CMEMC_DOCKER: docker run -i --rm -v {{.WORKING_DIRECTORY}}:/data -v {{.WORKING_DIRECTORY}}/{{.CMEMC_CONFIG}}:/{{.CMEMC_CONFIG}} {{.CMEMC_IMAGE}} -c {{.CMEMC_CONFIG_ID}} --config-file /{{.CMEMC_CONFIG}}
CMEMC: '{{.CMEMC | default .CMEMC_DOCKER}}'
GIT_USER_NAME: aksw.org Assets Update Bot 🤖
GIT_USER_EMAIL: [email protected]
GIT_COMMIT_MESSAGE: Update from Assets Manager
tasks:
default:
summary: List all tasks
silent: true
cmds:
- task --list
ci:
desc: Entry Point for the CI
cmds:
- task: cmemc:env-overwrite
vars: { CONFIG_KEYS: 'OAUTH_CLIENT_ID OAUTH_CLIENT_SECRET' }
- task: fetch
- task: track:commit-and-push
fetch:
desc: Get the program graph from cmem
cmds:
- |
if [ "$(curl --version|awk '{print $2;exit}'|cut -d. -f1)" -lt 8 ]; then
echo curl too old for IRI support
exit 1
fi
mkdir -p assets
{{.CMEMC}} query execute --accept application/json -p graph {{.INTEGRATION_GRAPH_IRI}} queries/foaf_depiction.rq.tpl |\
jq -r ".results.bindings[].url.value" |\
while read -r url
do
md5=($(echo -n $url | md5sum -))
echo "file assets/$md5: download $url"
if curl -S -s -f -L -o assets/$md5.tmp "$url"; then
mv assets/$md5.tmp assets/$md5
else
echo "file assets/$md5: failed"
rm -f assets/$md5.tmp 2>/dev/null
fi
done
track:commit-and-push:
desc: Commit and push all changes made to the directories
cmds:
- |
echo "commit-id-old=$(git rev-parse HEAD)" >> {{.GITHUB_OUTPUT}}
git add assets
git -c user.name="{{.GIT_USER_NAME}}" -c user.email="{{.GIT_USER_EMAIL}}" commit -m "{{.GIT_COMMIT_MESSAGE}}" || echo ""
echo "commit-id-new=$(git rev-parse HEAD)" >> {{.GITHUB_OUTPUT}}
git push || echo ""
cmemc:env-overwrite:
desc: A helper task to overwrite the cmemc config variables in a CI
cmds:
- python ./tools/cmemc_env_overwrite.py {{.CMEMC_CONFIG}} {{.CMEMC_CONFIG_ID}} {{.CONFIG_KEYS}}
status:
- '[ ${CMEMC_ENV_OVERWRITE} != "True" ]'