diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..a4fd99f --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,79 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +## Runs the release-please action for all new pushes to the main branch. +## This will create new release-PRs, create GitHub and npm releases, +## and update the CHANGELOG.md. + +on: + push: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: write + pull-requests: write + +name: Release Please + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - id: release + name: Release Please + uses: google-github-actions/release-please-action@v4 + + with: + release-type: node + token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} + package-name: "@googlemaps/react-native-navigation-sdk" + bump-minor-pre-major: true + + # Everything below is for NPM publishing when a release is cut. + # Note the "if" statement on all commands to make sure that publishing + # only happens when a release is cut. + + - if: ${{ steps.release.outputs.release_created }} + name: Checkout + uses: actions/checkout@v4 + + - if: ${{ steps.release.outputs.release_created }} + name: Setup Node for Dependency Installation + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - if: ${{ steps.release.outputs.release_created }} + name: Install Dependencies + run: npm ci + + # Now configure node with the registry used for publishing + - if: ${{ steps.release.outputs.release_created }} + name: Setup Node for Publishing + uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: "https://wombat-dressing-room.appspot.com/" + + - if: ${{ steps.release.outputs.release_created }} + name: Publish + # npm publish will trigger the build via the prepack hook + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_WOMBOT_TOKEN }} diff --git a/README.md b/README.md index 879a808..7d85bdc 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Description -This repository contains a React Native plugin that provides a [Google Navigation](https://developers.google.com/maps/documentation/navigation) widget to React Native apps targeting Android and iOS. +This repository contains a React Native plugin that provides a [Google Navigation](https://developers.google.com/maps/documentation/navigation) component for building native Android and iOS apps using React. > [!NOTE] > This package is in Beta until it reaches version 1.0. According to [semantic versioning](https://semver.org/#spec-item-4), breaking changes may be introduced before 1.0. @@ -29,11 +29,17 @@ This repository contains a React Native plugin that provides a [Google Navigatio ## Installation -1. To install the library run the following command from your project root: +This package is listed on NPM as [@googlemaps/react-native-navigation-sdk](https://www.npmjs.com/package/@googlemaps/react-native-navigation-sdk). Install it with: -`npm install --save https://github.com/googlemaps/react-native-navigation-sdk#{version_tag}` +```shell +npm i @googlemaps/react-native-navigation-sdk +``` + +In your TSX or JSX file, import the components you need: -For more details, see [Google Navigation SDK Documentation](https://developers.google.com/maps/documentation/navigation). +```tsx +import { NavigationView } from '@googlemaps/react-native-navigation-sdk'; +``` ### Android @@ -120,8 +126,8 @@ import {request, PERMISSIONS, RESULTS} from 'react-native-permissions'; // Request permission for accessing the device's location. const requestPermissions = async () => { const result = await request( - Platform.OS === "android" ? - PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION : + Platform.OS === "android" ? + PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION : PERMISSIONS.IOS.LOCATION_ALWAYS, ); diff --git a/package.json b/package.json index db0668f..1bc41f5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "react-native-navigation-sdk", "version": "1.0.0-beta", "author": "Google", - "description": "A react-native library for Google's Navigation SDK", + "description": "A React Native library for Navigation SDK on Google Maps Platform", "main": "lib/commonjs/index", "module": "lib/module/index", "types": "lib/typescript/src/index.d.ts", @@ -41,6 +41,7 @@ "android", "library", "google-navigation", + "navigation-sdk", "navsdk" ], "publishConfig": { @@ -151,5 +152,8 @@ } ] ] + }, + "publishConfig": { + "registry": "https://wombat-dressing-room.appspot.com" } }