Skip to content

Commit e170e61

Browse files
committed
Move protomaps server URL into GitHub secrets along with new API key
Update GitHub workflows to extract the values into local.properties.
1 parent 7611b89 commit e170e61

13 files changed

Lines changed: 62 additions & 281 deletions

File tree

.github/workflows/build-app.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,13 @@ jobs:
7070
id: get-version
7171
run: echo "VERSION=$(git describe --tags)" >> $GITHUB_OUTPUT
7272

73-
#- name: Setup tile provider API key
74-
# env:
75-
# TILE_PROVIDER_API_KEY: ${{ secrets.TILE_PROVIDER_API_KEY }}
76-
# run: |
77-
# echo tileProviderApiKey=$TILE_PROVIDER_API_KEY > local.properties
73+
- name: Setup tile provider API key
74+
env:
75+
TILE_PROVIDER_API_KEY: ${{ secrets.TILE_PROVIDER_API_KEY }}
76+
TILE_PROVIDER_URL: ${{ secrets.TILE_PROVIDER_URL }}
77+
run: |
78+
echo tileProviderUrl=$TILE_PROVIDER_URL > local.properties
79+
echo tileProviderApiKey=$TILE_PROVIDER_API_KEY >> local.properties
7880
7981
- name: Decode Google services
8082
env:

.github/workflows/nightly.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ jobs:
4848
with:
4949
fetch-depth: 0
5050

51-
#- name: Setup tile provider API key
52-
# env:
53-
# TILE_PROVIDER_API_KEY: ${{ secrets.TILE_PROVIDER_API_KEY }}
54-
# run: |
55-
# echo tileProviderApiKey=$TILE_PROVIDER_API_KEY > local.properties
51+
- name: Setup tile provider
52+
env:
53+
TILE_PROVIDER_API_KEY: ${{ secrets.TILE_PROVIDER_API_KEY }}
54+
TILE_PROVIDER_URL: ${{ secrets.TILE_PROVIDER_URL }}
55+
run: |
56+
echo tileProviderUrl=$TILE_PROVIDER_URL > local.properties
57+
echo tileProviderApiKey=$TILE_PROVIDER_API_KEY >> local.properties
5658
5759
- name: Decode Google services
5860
env:
@@ -127,11 +129,13 @@ jobs:
127129
with:
128130
fetch-depth: 0
129131

130-
#- name: Setup tile provider API key
131-
# env:
132-
# TILE_PROVIDER_API_KEY: ${{ secrets.TILE_PROVIDER_API_KEY }}
133-
# run: |
134-
# echo tileProviderApiKey=$TILE_PROVIDER_API_KEY > local.properties
132+
- name: Setup tile provider
133+
env:
134+
TILE_PROVIDER_API_KEY: ${{ secrets.TILE_PROVIDER_API_KEY }}
135+
TILE_PROVIDER_URL: ${{ secrets.TILE_PROVIDER_URL }}
136+
run: |
137+
echo tileProviderUrl=$TILE_PROVIDER_URL > local.properties
138+
echo tileProviderApiKey=$TILE_PROVIDER_API_KEY >> local.properties
135139
136140
- name: Decode Google services
137141
env:

.github/workflows/run-tests.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ jobs:
2525
with:
2626
fetch-depth: 0
2727

28+
- name: Setup tile provider
29+
env:
30+
TILE_PROVIDER_API_KEY: ${{ secrets.TILE_PROVIDER_API_KEY }}
31+
TILE_PROVIDER_URL: ${{ secrets.TILE_PROVIDER_URL }}
32+
run: |
33+
echo tileProviderUrl=$TILE_PROVIDER_URL > local.properties
34+
echo tileProviderApiKey=$TILE_PROVIDER_API_KEY >> local.properties
35+
2836
- name: Setup Gradle
2937
uses: gradle/actions/setup-gradle@v4
3038

.github/workflows/tag-and-build-release.yaml

Lines changed: 0 additions & 244 deletions
This file was deleted.

app/build.gradle.kts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import com.google.protobuf.gradle.id
2+
import java.io.FileInputStream
3+
import java.util.Properties
24

35
plugins {
46
alias(libs.plugins.android.application)
@@ -45,20 +47,21 @@ android {
4547
versionCode = 86
4648
versionName = "0.0.85"
4749

48-
// We don't currently require a Tile provider API key
49-
//
50-
// // Retrieve the tile provider API from local.properties. This is not under version control
51-
// // and must be configured by each developer locally. GitHb actions fill in local.properties
52-
// // from a secret.
53-
// var tileProviderApiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
54-
// try {
55-
// val localProperties = Properties()
56-
// localProperties.load(FileInputStream(rootProject.file("local.properties")))
57-
// tileProviderApiKey = localProperties["tileProviderApiKey"].toString()
58-
// } catch (e: Exception) {
59-
// println("Failed to load local.properties for TILE_PROVIDER_API_KEY: $e")
60-
// }
61-
// buildConfigField("String", "TILE_PROVIDER_API_KEY", "\"${tileProviderApiKey}\"")
50+
// Retrieve the tile provider URL and API key from local.properties. This is not under
51+
// version control and must be configured by each developer locally. GitHub actions fill in
52+
// local.properties from a secret.
53+
var tileProviderUrl = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
54+
var tileProviderApiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
55+
try {
56+
val localProperties = Properties()
57+
localProperties.load(FileInputStream(rootProject.file("local.properties")))
58+
tileProviderUrl = localProperties["tileProviderUrl"].toString()
59+
tileProviderApiKey = localProperties["tileProviderApiKey"].toString()
60+
} catch (e: Exception) {
61+
println("Failed to load local.properties for tile provider: $e")
62+
}
63+
buildConfigField("String", "TILE_PROVIDER_URL", "\"${tileProviderUrl}\"")
64+
buildConfigField("String", "TILE_PROVIDER_API_KEY", "\"${tileProviderApiKey}\"")
6265

6366
buildConfigField("String", "VERSION_NAME", "\"${versionName}\"")
6467
buildConfigField("String", "FMOD_LIB", "\"fmod\"")

0 commit comments

Comments
 (0)