diff --git a/.github/workflows/export-cms-entitiesv2.yml b/.github/workflows/export-cms-entitiesv2.yml new file mode 100644 index 0000000..047795d --- /dev/null +++ b/.github/workflows/export-cms-entitiesv2.yml @@ -0,0 +1,121 @@ +name: Export Footlight-CMS entities to Artsdata v2 + +on: + workflow_call: + inputs: + calendar_id: + required: true + type: string + login_email: + required: true + type: string + secrets: + PUBLISHER_URI_GREGORY: + required: true + S3_ACCESS_KEY_ID: + required: true + S3_SECRET_ACCESS_KEY: + required: true + LOGIN_PASSWORD: + required: true + + +jobs: + get-rdf-data: + runs-on: ubuntu-latest + outputs: + calendar-slug: ${{ steps.get-calendar-slug.outputs.CALENDAR_SLUG }} + steps: + - name: Login to CMS + id: login-step + run: | + response=$(curl -s -X 'POST' \ + 'https://api.cms.footlight.io/login' \ + -H 'accept: */*' \ + -H 'Content-Type: application/json' \ + -H 'Referer: https://api.cms.footlight.io/export' \ + -d '{ + "email": "'"${{inputs.login_email}}"'", + "password": "'"${{secrets.LOGIN_PASSWORD}}"'" + }') + token=$(echo $response | jq -r '.accessToken') + echo "::add-mask::$token" # Mask the token + echo "ACCESS_TOKEN=$token" >> $GITHUB_OUTPUT + + - name: Get calendar slug + id: get-calendar-slug + run: | + response=$(curl -X 'GET' \ + "https://api.cms.footlight.io/calendars/${{inputs.calendar_id}}" \ + -H "accept: */*" \ + -H "Authorization: Bearer ${{steps.login-step.outputs.ACCESS_TOKEN}}" \ + -H "Referer: https://api.cms.footlight.io/export") + + slug=$(echo "$response" | jq -r '.slug') + + echo "CALENDAR_SLUG=$slug" >> $GITHUB_OUTPUT + + - name: Export entities + run: | + curl -X 'GET' \ + 'https://api.cms.footlight.io/entities/export?file-format=ttl&entity=Event' \ + -H 'accept: */*' \ + -H 'calendar-id: ${{inputs.calendar_id}}' \ + -H 'Referer: https://api.cms.footlight.io/export' \ + -H 'Authorization: Bearer ${{steps.login-step.outputs.ACCESS_TOKEN}}' \ + >> events.ttl + + curl -X 'GET' \ + 'https://api.cms.footlight.io/entities/export?file-format=ttl&entity=Person' \ + -H 'accept: */*' \ + -H 'calendar-id: ${{inputs.calendar_id}}' \ + -H 'Referer: https://api.cms.footlight.io/export' \ + -H 'Authorization: Bearer ${{steps.login-step.outputs.ACCESS_TOKEN}}' \ + >> people.ttl + + curl -X 'GET' \ + 'https://api.cms.footlight.io/entities/export?file-format=ttl&entity=Organization' \ + -H 'accept: */*' \ + -H 'calendar-id: ${{inputs.calendar_id}}' \ + -H 'Referer: https://api.cms.footlight.io/export' \ + -H 'Authorization: Bearer ${{steps.login-step.outputs.ACCESS_TOKEN}}' \ + >> organizations.ttl + + curl -X 'GET' \ + 'https://api.cms.footlight.io/entities/export?file-format=ttl&entity=Place' \ + -H 'accept: */*' \ + -H 'calendar-id: ${{inputs.calendar_id}}' \ + -H 'Referer: https://api.cms.footlight.io/export' \ + -H 'Authorization: Bearer ${{steps.login-step.outputs.ACCESS_TOKEN}}' \ + >> places.ttl + + - name: Concatenate the files + run : | + cat \ + events.ttl \ + places.ttl \ + organizations.ttl \ + people.ttl \ + > ${{steps.get-calendar-slug.outputs.CALENDAR_SLUG}}.ttl + + - name: Upload entities in RDF to S3 + uses: keithweaver/aws-s3-github-action@v1.0.0 + with: + command: cp + source: ${{steps.get-calendar-slug.outputs.CALENDAR_SLUG}}.ttl + 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-entities-to-artsdata: + needs: get-rdf-data + runs-on: ubuntu-latest + steps: + - name: Call artsdata pipeline action + uses: culturecreates/artsdata-pipeline-action@v1.1.0 + with: + artifact: "${{needs.get-rdf-data.outputs.calendar-slug}}v2" + publisher: ${{ secrets.PUBLISHER_URI_GREGORY }} + downloadUrl: "https://footlight-cms-entities-exported.s3.ca-central-1.amazonaws.com/${{needs.get-rdf-data.outputs.calendar-slug}}.ttl" diff --git a/.github/workflows/export-signe-laval-entities-to-artsdatav2.yml b/.github/workflows/export-signe-laval-entities-to-artsdatav2.yml new file mode 100644 index 0000000..e082cb3 --- /dev/null +++ b/.github/workflows/export-signe-laval-entities-to-artsdatav2.yml @@ -0,0 +1,17 @@ +name: Export Signe Laval calendar to Artsdata + +on: + workflow_dispatch: + +jobs: + call-export-workflow: + uses: ./.github/workflows/export-cms-entitiesv2.yml + with: + calendar_id: ${{ vars.SIGNE_LAVAL_CALENDAR_ID }} + login_email: ${{ vars.CMS_LOGIN_EMAIL }} + secrets: + PUBLISHER_URI_GREGORY: ${{ secrets.PUBLISHER_URI_GREGORY }} + S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} + S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} + LOGIN_PASSWORD: ${{ secrets.CMS_LOGIN_PASSWORD }} + diff --git a/.github/workflows/export-tout-culture-entities-to-artsdatav2.yml b/.github/workflows/export-tout-culture-entities-to-artsdatav2.yml new file mode 100644 index 0000000..2ce02a2 --- /dev/null +++ b/.github/workflows/export-tout-culture-entities-to-artsdatav2.yml @@ -0,0 +1,16 @@ +name: Export Tout Culture calendar to Artsdata + +on: + workflow_dispatch: + +jobs: + call-export-workflow: + uses: ./.github/workflows/export-cms-entitiesv2.yml + with: + calendar_id: ${{ vars.TOUT_CULTURE_CALENDAR_ID }} + login_email: ${{ vars.CMS_LOGIN_EMAIL }} + secrets: + PUBLISHER_URI_GREGORY: ${{ secrets.PUBLISHER_URI_GREGORY }} + S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} + S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} + LOGIN_PASSWORD: ${{ secrets.CMS_LOGIN_PASSWORD }}