-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
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/[email protected] | ||
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" |
17 changes: 17 additions & 0 deletions
17
.github/workflows/export-signe-laval-entities-to-artsdatav2.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} | ||
|
16 changes: 16 additions & 0 deletions
16
.github/workflows/export-tout-culture-entities-to-artsdatav2.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |