3-create-openair-standard #14
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
# Create OpenAir Standard | |
name: 3-create-openair-standard | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "master" branch | |
workflow_run: | |
workflows: ["1-[main] Validate, Add Version, Convert, Push to FTP"] | |
types: | |
- completed | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
# see: https://github.com/marketplace/actions/ftp-deployment | |
jobs: | |
convert-openair-standard: | |
name: Convert to OpenAir standard | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🚚 Get latest code | |
uses: actions/checkout@v3 | |
with: | |
path: ./airspace | |
- name: 🚚 Get OpenAirExtended2OpenAir | |
uses: actions/checkout@v3 | |
with: | |
repository: llauner/OpenAirExtended2OpenAir | |
token: ${{ secrets.ACCESS_TOKEN }} | |
path: ./OpenAirExtended2OpenAir | |
ref: master | |
- name: 🚚 Get openaip-openair-parser | |
uses: actions/checkout@v3 | |
with: | |
repository: openAIP/openaip-openair-parser | |
path: ./openaip-openair-parser | |
ref: master | |
- name: Convert to OpenAir standard | |
id: convert | |
run: | | |
echo "## Install OpenAirExtended2OpenAir" | |
cd OpenAirExtended2OpenAir | |
npm install | |
echo "## Converting ..." | |
rm ../airspace/france_openair_standard.txt | |
node ./main.js ../airspace/france.txt ../airspace/france_openair_standard.txt | |
- name: Validate france_openair_standard.txt | |
id: validation | |
run: | | |
echo "## Install openaip-openair-parser" | |
cd openaip-openair-parser | |
npm install | |
echo "## Validating ..." | |
node ./cli.js -f ../airspace/france_openair_standard.txt --validate --debug -o ./tmp.geojson | |
rm ./tmp.geojson | |
SCRIPT_OUTPUT=$(node ./cli.js -f ../airspace/france_openair_standard.txt --validate --debug -o ./tmp.geojson) | |
SCRIPT_RC=$? | |
echo "parser_output=$SCRIPT_OUTPUT" | |
echo "parser_output=$SCRIPT_OUTPUT" >> $GITHUB_OUTPUT | |
- name: Display validation output | |
run: | | |
echo "Validation output=" | |
echo ${{steps.validation.outputs.parser_output}} | |
- name: Check validation | |
if: contains(steps.validation.outputs.parser_output, 'Error') | |
uses: actions/github-script@v3 | |
with: | |
script: | | |
always() && | |
core.setFailed('Validation failed ! See Above step for details...') | |
- name: Get commit Message | |
id: get_commit_message | |
run: | | |
# Save commit message for future push | |
cd ./airspace | |
echo "LAST_COMMIT_MESSSAGE=`git log --format=%s -n 1 -- france.txt`" >> $GITHUB_OUTPUT | |
- name: ⚙️ Push france_openair_standard.txt to repo | |
id: push_changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
repository: ./airspace | |
commit_message: ${{ steps.get_commit_message.outputs.LAST_COMMIT_MESSSAGE }} | |
file_pattern: 'france_openair_standard.txt' | |
publish-pages: | |
name: Pyublish pages to github pages | |
runs-on: ubuntu-latest | |
needs: [convert-openair-standard] | |
steps: | |
- name: Trigger event for github pages update | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
event-type: update-pages-event |