File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,10 +32,19 @@ jobs:
3232 - name : Checkout
3333 uses : actions/checkout@v4
3434
35- # TODO: Inject the API Key secret into the source file
36- # - name: Inject API Key
37- # run: |
38- # sed -i 's/REPLACE_WITH_MY_API_KEY/${{ secrets.MY_API_KEY }}/g' main.js
35+ # Inject the API Key secret into the source file
36+ - name : Inject API Key
37+ env :
38+ MT_MAPS_JS_API_KEY : ${{ secrets.MT_MAPS_JS_API_KEY }}
39+ run : |
40+ set -euo pipefail
41+ if [ -z "${MT_MAPS_JS_API_KEY}" ]; then
42+ echo "MT_MAPS_JS_API_KEY is not set" >&2
43+ exit 1
44+ fi
45+ esc_key=$(printf '%s' "$MT_MAPS_JS_API_KEY" | sed -e 's/[\\/&]/\\\\&/g')
46+ sed -i "s/MT_REPLACE_WITH_MAPS_JS_API_KEY/${esc_key}/g" ./index.html
47+ sed -i "s/MT_REPLACE_WITH_MAPS_JS_API_KEY/${esc_key}/g" ./dev/map/empty.html
3948
4049
4150 - name : Setup Pages
Original file line number Diff line number Diff line change 1717 </ style >
1818
1919 <!-- This APK key is restricted to 'Maps JavaScript API' on 'mtransitapps.github.io' website: -->
20- < script type ="text/javascript " src ="https://maps.googleapis.com/maps/api/js?key=AIzaSyCrAHs1Dp4dgQxA0-17PJqaCfK_Jpg85Hs &libraries=maps "> </ script >
20+ < script type ="text/javascript " src ="https://maps.googleapis.com/maps/api/js?key=MT_REPLACE_WITH_MAPS_JS_API_KEY &libraries=maps "> </ script >
2121 <!-- Use demo key for local testing: https://developers.google.com/maps/documentation/javascript/demo-key -->
2222 <!-- <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=INSERT_DEMO_KEY_HERE&libraries=maps"></script> -->
2323
Original file line number Diff line number Diff line change 9090 </ style >
9191
9292 <!-- This APK key is restricted to 'Maps JavaScript API' on 'mtransitapps.github.io' website: -->
93- < script type ="text/javascript " src ="https://maps.googleapis.com/maps/api/js?key=AIzaSyCrAHs1Dp4dgQxA0-17PJqaCfK_Jpg85Hs &libraries=maps,marker "> </ script >
93+ < script type ="text/javascript " src ="https://maps.googleapis.com/maps/api/js?key=MT_REPLACE_WITH_MAPS_JS_API_KEY &libraries=maps,marker "> </ script >
9494 <!-- Use demo key for local testing: https://developers.google.com/maps/documentation/javascript/demo-key -->
9595 <!-- <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=INSERT_DEMO_KEY_HERE&libraries=maps,marker"></script> -->
9696
You can’t perform that action at this time.
0 commit comments