BlueBike API publishing #47956
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
name: BlueBike API publishing | |
on: | |
schedule: | |
- cron: "*/5 * * * *" | |
repository_dispatch: | |
types: [push] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-20.04 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
# Checkout repo | |
- uses: actions/checkout@v2 | |
# Generate RDF using RMLMapper | |
- run: mkdir -p public/history | |
- run: wget https://github.com/RMLio/rmlmapper-java/releases/download/v6.0.0/rmlmapper-6.0.0-r363-all.jar | |
- run: java -jar rmlmapper-6.0.0-r363-all.jar -m mapping-webapi-official.rml.ttl | |
# History | |
- run: echo "DATE=$(date '+%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV | |
- run: echo "FILE=$(echo ${{ env.DATE }} | sed 's/-//g' | sed 's/://g')" >> $GITHUB_ENV | |
- run: cp ./history/bluebike.ttl "./history/${{ env.FILE }}.ttl" | |
# append to file list. | |
- run: | | |
echo "${{ env.DATE }},${{ env.FILE }}.ttl" >> list.csv | |
# generate root.ttl | |
- run: java -jar rmlmapper-6.0.0-r363-all.jar -m root.rml.ttl | |
# make everything public | |
- run: cp ./history/*.ttl ./public/history/ | |
- run: cp root.ttl ./public/root.ttl | |
- run: | | |
# setup the username and email. | |
git config user.name "Pieter's GitHub Actions Bot" | |
git config user.email "<[email protected]>" | |
- run: | | |
# commit | |
git add root.ttl | |
git add list.csv | |
git add history | |
git commit -m "history: update ${{ env.DATE }}" | |
git push origin master | |
# Execute deployment only on production | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/master' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public |