From ba18c3669a3a01278b4735d96132fd39bc1248e0 Mon Sep 17 00:00:00 2001 From: Chris Arriola Date: Mon, 4 Oct 2021 12:57:04 -0700 Subject: [PATCH] feat: Add Android lib files. --- .github/sync-files.yml | 14 +++++ .gitignore | 2 +- .../android/.github/workflows/release.yml | 59 +++++++++++++++++++ sync-files/android/.github/workflows/test.yml | 46 +++++++++++++++ sync-files/android/.releaserc | 25 ++++++++ 5 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 sync-files/android/.github/workflows/release.yml create mode 100644 sync-files/android/.github/workflows/test.yml create mode 100644 sync-files/android/.releaserc diff --git a/.github/sync-files.yml b/.github/sync-files.yml index 36b9997..d09ab69 100644 --- a/.github/sync-files.yml +++ b/.github/sync-files.yml @@ -45,6 +45,7 @@ group: # gh repo list googlemaps --public --source --no-archived --json name | jq '.[] | .name' repos: | googlemaps/.github + googlemaps/android-v3-migration googlemaps/android-maps-ktx googlemaps/android-maps-rx googlemaps/android-maps-utils @@ -74,3 +75,16 @@ group: googlemaps/playablelocations-proxy googlemaps/react-wrapper googlemaps/semantic-release-config + # Android Library files + - files: + - source: sync-files/android/.github/ + dest: .github/ + - source: sync-files/android/.releaserc + dest: .releaserc + repos: | + googlemaps/android-maps-ktx + googlemaps/android-maps-rx + googlemaps/android-maps-utils + googlemaps/android-places-ktx + googlemaps/android-v3-migration + # Exclude Android sample repos diff --git a/.gitignore b/.gitignore index 8b13789..e43b0f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ - +.DS_Store diff --git a/sync-files/android/.github/workflows/release.yml b/sync-files/android/.github/workflows/release.yml new file mode 100644 index 0000000..1fb9291 --- /dev/null +++ b/sync-files/android/.github/workflows/release.yml @@ -0,0 +1,59 @@ +# Copyright 2020 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. + +name: Release +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} + - uses: gradle/wrapper-validation-action@v1.0.4 + - name: Create .gpg key + run: | + echo $GPG_KEY_ARMOR | base64 --decode > ./release.asc + gpg --quiet --output $GITHUB_WORKSPACE/release.gpg --dearmor ./release.asc + + echo "Build and publish" + sed -i -e "s,sonatypeUsername=,sonatypeUsername=$SONATYPE_USERNAME,g" gradle.properties + SONATYPE_PASSWORD_ESCAPED=$(printf '%s\n' "$SONATYPE_PASSWORD" | sed -e 's/[\/&]/\\&/g') + sed -i -e "s,sonatypePassword=,sonatypePassword=$SONATYPE_PASSWORD_ESCAPED,g" gradle.properties + sed -i -e "s,signing.keyId=,signing.keyId=$GPG_KEY_ID,g" gradle.properties + sed -i -e "s,signing.password=,signing.password=$GPG_PASSWORD,g" gradle.properties + sed -i -e "s,signing.secretKeyRingFile=,signing.secretKeyRingFile=$GITHUB_WORKSPACE/release.gpg,g" gradle.properties + env: + GPG_KEY_ARMOR: "${{ secrets.SYNCED_GPG_KEY_ARMOR }}" + GPG_KEY_ID: ${{ secrets.SYNCED_GPG_KEY_ID }} + GPG_PASSWORD: ${{ secrets.SYNCED_GPG_KEY_PASSWORD }} + SONATYPE_PASSWORD: ${{ secrets.SYNCED_SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SYNCED_SONATYPE_USERNAME }} + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v2 + with: + extra_plugins: | + "@semantic-release/commit-analyzer" + "@semantic-release/release-notes-generator" + "@google/semantic-release-replace-plugin" + "@semantic-release/exec" + "@semantic-release/git + "@semantic-release/github + env: + GH_TOKEN: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} diff --git a/sync-files/android/.github/workflows/test.yml b/sync-files/android/.github/workflows/test.yml new file mode 100644 index 0000000..7b751d9 --- /dev/null +++ b/sync-files/android/.github/workflows/test.yml @@ -0,0 +1,46 @@ +# Copyright 2020 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. + +# A workflow that runs tests on every new pull request +name: Run unit tests + +on: + repository_dispatch: + types: [test] + push: + branches: ['*'] + pull_request: + branches: ['*'] + workflow_dispatch: + +jobs: + run-unit-test: + runs-on: ubuntu-latest + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout Repo + uses: actions/checkout@v2 + + - name: Gradle Wrapper Validation + uses: gradle/wrapper-validation-action@v1.0.4 + + - name: Set up JDK 11 + uses: actions/setup-java@v2.3.0 + with: + java-version: '11' + distribution: 'adopt' + + - name: Build modules + run: ./gradlew build jacocoTestReport --stacktrace diff --git a/sync-files/android/.releaserc b/sync-files/android/.releaserc new file mode 100644 index 0000000..43f58c1 --- /dev/null +++ b/sync-files/android/.releaserc @@ -0,0 +1,25 @@ +branches: + - main +plugins: + - "@semantic-release/commit-analyzer" + - "@semantic-release/release-notes-generator" + - - "@google/semantic-release-replace-plugin" + - replacements: + - files: + - "./build.gradle(.kts)?" + from: "\\bversion = '.*'" + to: "version = '${nextRelease.version}'" + - files: + - "README.md" + from: "ktx:[0-9].[0-9].[0-9]" + to: "ktx:${nextRelease.version}" + - - "@semantic-release/exec" + - prepareCmd: "./gradlew build --warn --stacktrace" + publishCmd: "./gradlew publish --warn --stacktrace" + - - "@semantic-release/git" + - assets: + - "./build.gradle(.kts)?" + - "*.md" + - "@semantic-release/github" +options: + debug: true