Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions .github/workflows/android-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ on:
secrets:
MAPBOX_ACCESS_TOKEN:
required: true
MAPBOX_DOWNLOAD_TOKEN:
required: true
ENV_MAPBOX_ACCESS_TOKEN:
required: false
ENV_MAPBOX_DOWNLOAD_TOKEN:
required: false

jobs:
build_example:
Expand Down Expand Up @@ -60,13 +56,7 @@ jobs:
distribution: 'zulu'
java-version: '17'

- run: |
mkdir -p ~/.gradle/
echo MAPBOX_DOWNLOADS_TOKEN=$MAPBOX_DOWNLOAD_TOKEN > ~/.gradle/gradle.properties
working-directory: example
env:
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN || secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}


- run: echo $MAPBOX_ACCESS_TOKEN > ./accesstoken
working-directory: example
env:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci-for-forked-repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ jobs:
env_name: CI with Mapbox Tokens
ref: ${{ github.event.pull_request.head.sha }}
secrets:
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}

22 changes: 2 additions & 20 deletions .github/workflows/ci-requiring-tokens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ on:
secrets:
MAPBOX_ACCESS_TOKEN:
required: false
MAPBOX_DOWNLOAD_TOKEN:
required: false
ENV_MAPBOX_ACCESS_TOKEN:
required: false
ENV_MAPBOX_DOWNLOAD_TOKEN:
required: false

concurrency:
concurrency:
group: ${{ github.head_ref || github.run_id }}-ci-with-tokens
cancel-in-progress: true

Expand All @@ -38,9 +34,7 @@ jobs:
MAP_IMPL: mapbox
secrets:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}

call_android_workflow_fabric:
name: "Android/Mapbox/Fabric"
Expand All @@ -53,9 +47,7 @@ jobs:
NEW_ARCH: true
secrets:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}


call_android_workflow_11:
Expand All @@ -68,9 +60,7 @@ jobs:
MAP_IMPL: mapbox11
secrets:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}

call_ios_workflow:
name: "iOS/Mapbox"
Expand All @@ -82,9 +72,7 @@ jobs:
MAP_IMPL: mapbox
secrets:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}

call_ios_workflow_fabric:
name: "iOS/Mapbox/Fabric"
Expand All @@ -97,9 +85,7 @@ jobs:
NEW_ARCH: true
secrets:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}

call_ios_workflow_11:
name: "iOS/Mapbox11"
Expand All @@ -111,10 +97,8 @@ jobs:
MAP_IMPL: mapbox11
secrets:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}


call_web_workflow:
name: "Web/Mapbox"
uses: ./.github/workflows/web-actions.yml
Expand All @@ -124,6 +108,4 @@ jobs:
NVMRC: ${{ inputs.NVMRC }}
secrets:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}
15 changes: 1 addition & 14 deletions .github/workflows/ios-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ on:
secrets:
MAPBOX_ACCESS_TOKEN:
required: true
MAPBOX_DOWNLOAD_TOKEN:
required: true
ENV_MAPBOX_ACCESS_TOKEN:
required: false
ENV_MAPBOX_DOWNLOAD_TOKEN:
required: false

jobs:
build:
Expand Down Expand Up @@ -60,16 +56,7 @@ jobs:
env:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN || secrets.ENV_MAPBOX_ACCESS_TOKEN }}

- name: Setup .netrc with MAPBOX_DOWNLOAD_TOKEN
run: |
echo 'machine api.mapbox.com' >> ~/.netrc
echo 'login mapbox' >> ~/.netrc
echo "password $MAPBOX_DOWNLOAD_TOKEN" >> ~/.netrc
chmod 0600 ~/.netrc
if: "${{ env.MAPBOX_DOWNLOAD_TOKEN != '' }}"
env:
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN || secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}


- name: Setup node ${{ inputs.NVMRC }}
uses: actions/setup-node@v3.5.1
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ jobs:
if: needs.has_mapbox_token.outputs.has-mapbox-token == 'true'
secrets:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}

publish:
if: startsWith(github.ref, 'refs/tags/') && (github.event_name == 'push')
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/web-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,15 @@ on:
type: string
ref:
required: false
type: string
type: string
NVMRC:
required: true
type: string
secrets:
MAPBOX_ACCESS_TOKEN:
required: true
MAPBOX_DOWNLOAD_TOKEN:
required: true
ENV_MAPBOX_ACCESS_TOKEN:
required: false
ENV_MAPBOX_DOWNLOAD_TOKEN:
required: false

jobs:
build_example:
Expand All @@ -32,7 +28,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
if: ${{ inputs.ref == '' }}

- name: Checkout fork
uses: actions/checkout@v4
if: ${{ inputs.ref != '' }}
Expand All @@ -56,4 +52,4 @@ jobs:
working-directory: example

- run: npx expo export --platform web
working-directory: example
working-directory: example
17 changes: 3 additions & 14 deletions android/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

## Supported mapbox libraries

We're only supporting mapbox 10.16* and 11.*. The default is 10.16*.
We're only supporting mapbox 10.16* and 11.*. The default is 10.16*.
Next release will be 11.* only so we recommend updatign to 11.*

### Adding mapbox maven repo

You will need to authorize your download of the Maps SDK via a secret access token with the `DOWNLOADS:READ` scope.
This [guide](https://docs.mapbox.com/android/maps/guides/install/#configure-credentials) explains how to `Configure credentials` and `Configure your secret token`.

Then under section `allprojects/repositories` add your data:

```groovy
Expand All @@ -20,22 +17,14 @@ allprojects {
// ...other repos
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = 'mapbox'
// Use the secret token you stored in gradle.properties as the password
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
}
// ...even more repos?
}
}
```

*Note:* mapbox lifted auth requirement from downloads so MAPBOX_DOWNLOADS_TOKEN is no longer needed

### Using non default mapbox version

*Warning*: If you set a custom version, make sure you revisit, any time you update @rnmapbox/maps. Setting it to earlier version than what we exepect will likely result in a build error.
Expand Down
3 changes: 1 addition & 2 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ cd example
* Android: Set up your Mapbox developer keys as described in https://github.com/rnmapbox/maps/blob/main/android/install.md#adding-mapbox-maven-repo (no need to change build.gradle, just set up gradle.properties)

* iOS:
1. Set up your Mapbox developer keys as described in [https://github.com/rnmapbox/maps/blob/main/ios/install.md#adding-mapbox-maven-repo](https://github.com/rnmapbox/maps/blob/main/ios/install.md#mapbox-maps-sdk-v10) (add your cerdentials to .netrc as described)
2. Install pod dependencies
1. Install pod dependencies
```
cd ios
pod install
Expand Down
23 changes: 14 additions & 9 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,20 @@ allprojects {

maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = 'mapbox'
// Use the secret token you stored in gradle.properties as the password
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
// Authentication is no longer required as per Mapbox's removal of download token requirement
// See: https://github.com/mapbox/mapbox-maps-flutter/issues/775
// Keeping this as optional for backward compatibility
if (project.properties['MAPBOX_DOWNLOADS_TOKEN']) {
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = 'mapbox'
// Use the secret token you stored in gradle.properties as the password
password = project.properties['MAPBOX_DOWNLOADS_TOKEN']
}
}
}
}
Expand Down
16 changes: 10 additions & 6 deletions plugin/build/withMapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,16 @@ allprojects {
repositories {
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication { basic(BasicAuthentication) }
credentials {
username = 'mapbox'
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: System.getenv('RNMAPBOX_MAPS_DOWNLOAD_TOKEN') ?: {
throw new GradleException('❌ RNMapbox Maps Error: Mapbox download token is required.\\nSet RNMAPBOX_MAPS_DOWNLOAD_TOKEN environment variable:\\n export RNMAPBOX_MAPS_DOWNLOAD_TOKEN="sk.ey...qg"\\n npx expo prebuild\\n\\nOr use deprecated config:\\n RNMapboxMapsDownloadToken in app.json plugin config')
}()
// Authentication is no longer required as per Mapbox's removal of download token requirement
// See: https://github.com/mapbox/mapbox-maps-flutter/issues/775
// Keeping this as optional for backward compatibility
def token = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: System.getenv('RNMAPBOX_MAPS_DOWNLOAD_TOKEN')
if (token) {
authentication { basic(BasicAuthentication) }
credentials {
username = 'mapbox'
password = token
}
}
}
}
Expand Down
16 changes: 10 additions & 6 deletions plugin/src/withMapbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,16 @@ allprojects {
repositories {
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication { basic(BasicAuthentication) }
credentials {
username = 'mapbox'
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: System.getenv('RNMAPBOX_MAPS_DOWNLOAD_TOKEN') ?: {
throw new GradleException('❌ RNMapbox Maps Error: Mapbox download token is required.\\nSet RNMAPBOX_MAPS_DOWNLOAD_TOKEN environment variable:\\n export RNMAPBOX_MAPS_DOWNLOAD_TOKEN="sk.ey...qg"\\n npx expo prebuild\\n\\nOr use deprecated config:\\n RNMapboxMapsDownloadToken in app.json plugin config')
}()
// Authentication is no longer required as per Mapbox's removal of download token requirement
// See: https://github.com/mapbox/mapbox-maps-flutter/issues/775
// Keeping this as optional for backward compatibility
def token = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: System.getenv('RNMAPBOX_MAPS_DOWNLOAD_TOKEN')
if (token) {
authentication { basic(BasicAuthentication) }
credentials {
username = 'mapbox'
password = token
}
}
}
}
Expand Down
Loading