This repository has been archived by the owner on Feb 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.98 KB
/
readsb_json.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
name: Refresh readsb json files
on:
workflow_dispatch:
jobs:
readsb-json:
name: Update JSON files from readsb
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Ensure directory structure exists
run: |
set -x
mkdir -p ./datasources/readsb_json
- name: Check for changes
id: check-changes
run: |
set -x
curl -o ./datasources/readsb_json/dbversion.json https://raw.githubusercontent.com/Mictronics/readsb-protobuf/dev/webapp/src/db/dbversion.json
git add ./datasources/readsb_json/dbversion.json
CHANGES=$(git diff origin/main)
if [[ -n "$CHANGES" ]]; then
echo "::set-output name=add_and_commit::true"
fi
- name: Fetch latest readsb json files
if: steps.check-changes.outputs.add_and_commit == 'true'
run: |
set -x
curl -o ./datasources/readsb_json/aircrafts.json https://raw.githubusercontent.com/Mictronics/readsb-protobuf/dev/webapp/src/db/aircrafts.json
curl -o ./datasources/readsb_json/operators.json https://raw.githubusercontent.com/Mictronics/readsb-protobuf/dev/webapp/src/db/operators.json
curl -o ./datasources/readsb_json/types.json https://raw.githubusercontent.com/Mictronics/readsb-protobuf/dev/webapp/src/db/types.json
- name: Convert readsb JSON to Golang
if: steps.check-changes.outputs.add_and_commit == 'true'
run: |
set x
pushd ./datasources/readsb_json
go run readsbjson2gostruct.go -p "datasources" -o ../readsb_json_data.go
popd
gofmt -w ./datasources/readsb_json_data.go
- name: Add and commit
if: steps.check-changes.outputs.add_and_commit == 'true'
run: |
git config user.name github-actions
git config user.email [email protected]
git add ./datasources/readsb_json/*.json
git add ./datasources/readsb_json_data.go
git commit -m "update of readsb json files"
git push