1+ name : Publish
2+ on :
3+ push :
4+ workflow_dispatch :
5+
6+ jobs :
7+ check-vector-update :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - uses : actions/checkout@v4
11+ with :
12+ fetch-depth : 2
13+
14+ - name : Check if topographic-v2.json changed
15+ id : check_diff
16+ run : |
17+ if git diff --name-only HEAD^ HEAD | grep -q "^config/tileset/topographic.json$"; then
18+ echo "changed=true" >> $GITHUB_OUTPUT
19+ else
20+ echo "changed=false" >> $GITHUB_OUTPUT
21+ fi
22+
23+ publish-odr :
24+ needs : check-vector-update
25+ if : needs.check-vector-update.outputs.changed == 'true'
26+ # if: needs.check-vector-update.outputs.changed == 'true' && github.ref == 'refs/heads/master' && github.event_name == 'push'
27+ name : Publish ODR
28+ runs-on : ubuntu-latest
29+
30+ environment :
31+ name : prod
32+
33+ permissions :
34+ id-token : write
35+ contents : read
36+
37+ steps :
38+ - uses : linz/action-typescript@v3
39+ with :
40+ node-version : 20.x
41+
42+ - uses : actions/checkout@v4
43+ with :
44+ fetch-depth : 0
45+
46+ - name : Check if topographic-v2.json changed
47+ id : check_diff
48+ run : |
49+ if git diff --name-only HEAD^ HEAD | grep -q "^config/tileset/topographic-v2.json$"; then
50+ echo "changed=true" >> $GITHUB_OUTPUT
51+ else
52+ echo "changed=false" >> $GITHUB_OUTPUT
53+ fi
54+
55+ - name : Use Node.js 18.x
56+ uses : actions/setup-node@v4
57+ with :
58+ node-version : ' 18.x'
59+
60+ - name : Setup kubectl
61+ uses : azure/setup-kubectl@v4
62+ with :
63+ version : ' latest'
64+
65+ - name : AWS Configure
66+ uses : aws-actions/configure-aws-credentials@v4.0.1 # v4
67+ with :
68+ aws-region : ap-southeast-2
69+ mask-aws-account-id : true
70+ role-to-assume : ${{ secrets.AWS_ROLE_CI_TOPO_PROD }}
71+
72+ - name : Login to EKS
73+ run : |
74+ aws eks update-kubeconfig --name Workflows --region ap-southeast-2
75+
76+ - name : Check EKS connection
77+ run : |
78+ kubectl get nodes
79+
80+ - name : Install Argo
81+ run : |
82+ curl -sLO https://github.com/argoproj/argo-workflows/releases/download/v3.4.11/argo-linux-amd64.gz
83+ gunzip argo-linux-amd64.gz
84+ chmod +x argo-linux-amd64
85+ ./argo-linux-amd64 version
86+
87+ - name : Submit Copy Workflow
88+ run : |
89+ mapfile -t modified_parameter_files < <(
90+ jq -r '.layers[0] | to_entries[]
91+ | select(.key == "2193" or .key == "3857")
92+ | .value
93+ | sub("/topographic-v2.tar.co$"; "")' config/tileset/topographic-v2.json
94+ )
95+
96+ for file in "${modified_parameter_files[@]}"; do
97+ echo "File changed: $file"
98+ done
99+
100+ # for file in "${modified_parameter_files[@]}"; do
101+ # ./argo-linux-amd64 submit --wait --from wftmpl/copy -n argo -f "$file" -p aws_role_config_path="s3://linz-bucket-config/config-write.open-data-registry.json" -p exclude="collection.json$" --generate-name "publish-odr-file-copy-"
102+ # done
0 commit comments