Skip to content

Export Scenepro entities to Artsdata #34

Export Scenepro entities to Artsdata

Export Scenepro entities to Artsdata #34

name: Export Scenepro entities to Artsdata
on:
workflow_dispatch:
jobs:
transform-scenepro-entities:
runs-on: ubuntu-latest
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 && apk add coreutils
- name: Run Onto Refine server
id: step-2
run: /opt/ontorefine/dist/bin/ontorefine &
- name: Download scenepro entities
id: step-3
run: |
curl 'https://public-api.scenepro.ca/capacoa/organizations/diffuser/0/200?networkId=2' \
-H "Ocp-Apim-Subscription-Key: ${{vars.SCENEPRO_KEY}}" >> entities.json
- name: Download mapping file
id: step-4
run: |
curl 'https://raw.githubusercontent.com/culturecreates/artsdata-planet-scenepro/main/ontorefine/config.json' >> config.json
- name: Transform entities in JSON to RDF
id: step-5
run: |
/opt/ontorefine/dist/bin/ontorefine-cli \
transform entities.json \
-u http://localhost:7333 \
--configurations config.json \
-f json >> scenepro-entities.ttl
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: scenepro-entities
path: ./scenepro-entities.ttl
retention-days: 1
commit-file-to-github:
needs: transform-scenepro-entities
runs-on: ubuntu-latest
outputs:
commit-hash: ${{ steps.get_commit_hash.outputs.commit-hash }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: scenepro-entities
path: ./scenepro-entities
- name: Copy file
run: cp /home/runner/work/artsdata-planet-scenepro/artsdata-planet-scenepro/scenepro-entities/scenepro-entities.ttl ./outputs/scenepro-entities.ttl
- 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/scenepro-entities.ttl"
git commit -m "Push ScenePro entities TTL file"
git push
- name: Get commit hash
id: get_commit_hash
run: |
commit_hash=$(git rev-parse HEAD)
echo "commit-hash=$commit_hash" >> $GITHUB_OUTPUT
artsdata-push:
runs-on: ubuntu-latest
needs: commit-file-to-github
steps:
- name: Action setup
uses: culturecreates/[email protected]
with:
artifact: scenepro-orgs
publisher: "${{ secrets.PUBLISHER_URI_GREGORY }}"
downloadUrl: https://raw.githubusercontent.com/culturecreates/artsdata-planet-scenepro/${{ needs.commit-file-to-github.outputs.commit-hash }}/outputs/scenepro-entities.ttl