Skip to content

JSON-LD vocabulary generation from CSV files #28

JSON-LD vocabulary generation from CSV files

JSON-LD vocabulary generation from CSV files #28

Workflow file for this run

name: JSON-LD vocabulary generation from CSV files
on:
pull_request:
paths:
- 'scripts/src/**'
- 'locodes/**'
# Manually run the generation or split
workflow_dispatch:
inputs:
mode:
type: choice
description: 'The mode of the transformation to run'
required: true
options:
- json-ld
- split
directory:
type: choice
description: 'The location of input csv files to be split'
required: false
options:
- loc222csv
jobs:
json-ld:
if: contains(github.event.inputs.mode, 'json-ld')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: package
working-directory: scripts/
run: |
mvn -B package --file pom.xml
- name: copy locodes
run: |
mkdir scripts/target/csv
cp locodes/*.csv scripts/target/csv
- name: generate
working-directory: scripts/target/
run: |
java -jar "$(find -name *.jar)" -t json-ld -d csv
mv *.jsonld ../../vocab/
- name: commit json-ld
working-directory: vocab/
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "update UN/LOCODE vocabulary"
git push
split:
if: contains(github.event.inputs.mode, 'split')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: package
working-directory: scripts/
run: |
mvn -B package --file pom.xml
- name: upload transformer
uses: actions/upload-artifact@v2
with:
name: unlocode-transformer
path: scripts/target/unlocode-transformer-*.jar
- name: split locodes
working-directory: scripts/target
run: |
java -jar "$(find -name *.jar)" -t split -d classes/${{github.event.inputs.directory}}
mv *.csv ../../locodes/
- name: commit locodes
working-directory: locodes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "update UN/LOCODE files"
git push