diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 000000000..18292f83b --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,35 @@ +# Copyright 2025 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. + +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: release-please + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} + config-file: release-please-config.json + manifest-file: .release-please-manifest.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index b57d8bd6e..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,60 +0,0 @@ -# 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 }} - - - name: set up Java 21 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '21' - - - name: Build APKs - run: | - echo "Generating ApiDemos (Java) APKs" - cd $GITHUB_WORKSPACE/ApiDemos/project/ - ./gradlew assemble - cp ./java-app/build/outputs/apk/debug/java-app-debug.apk $GITHUB_WORKSPACE/ApiDemos-java-debug.apk - - echo "Generating Kotlin (Kotlin) APKs" - ./gradlew assemble - cp ./kotlin-app/build/outputs/apk/debug/kotlin-app-debug.apk $GITHUB_WORKSPACE/ApiDemos-kotlin-debug.apk - - - uses: actions/setup-node@v2 - with: - node-version: '14' - - - name: Semantic Release - uses: cycjimmy/semantic-release-action@v3.4.1 - with: - extra_plugins: | - "@semantic-release/commit-analyzer@8.0.1" - "@semantic-release/release-notes-generator@9.0.3" - "@google/semantic-release-replace-plugin@1.2.0" - "@semantic-release/git@9.0.1" - "@semantic-release/github@7.2.3" - env: - GH_TOKEN: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 000000000..e4750bfca --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.19.0" +} \ No newline at end of file diff --git a/.releaserc b/.releaserc deleted file mode 100644 index e0b93f731..000000000 --- a/.releaserc +++ /dev/null @@ -1,22 +0,0 @@ -branches: - - main -plugins: - - "@semantic-release/commit-analyzer" - - "@semantic-release/release-notes-generator" - - - "@google/semantic-release-replace-plugin" - - replacements: - - files: - - "./ApiDemos/project/java-app/build.gradle.kts" - - "./ApiDemos/project/kotlin-app/build.gradle.kts" - from: "versionName = \".*\"" - to: "versionName = \"${nextRelease.version}\"" - - - "@semantic-release/git" - - assets: - - "./ApiDemos/project/java-app/build.gradle.kts" - - "./ApiDemos/project/kotlin-app/build.gradle.kts" - - - "@semantic-release/github" - - assets: - - "./ApiDemos-java-debug.apk" - - "./ApiDemos-kotlin-debug.apk" -options: - debug: true diff --git a/ApiDemos/project/java-app/build.gradle.kts b/ApiDemos/project/java-app/build.gradle.kts index 6620ba462..11b300b2e 100644 --- a/ApiDemos/project/java-app/build.gradle.kts +++ b/ApiDemos/project/java-app/build.gradle.kts @@ -28,7 +28,9 @@ android { minSdk = libs.versions.minSdk.get().toInt() targetSdk = libs.versions.targetSdk.get().toInt() versionCode = 1 + // {x-release-please-start-version} versionName = "1.19.0" + // {x-release-please-end} multiDexEnabled = true testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } diff --git a/ApiDemos/project/kotlin-app/build.gradle.kts b/ApiDemos/project/kotlin-app/build.gradle.kts index e95fb93b9..81e3abbd9 100644 --- a/ApiDemos/project/kotlin-app/build.gradle.kts +++ b/ApiDemos/project/kotlin-app/build.gradle.kts @@ -31,7 +31,9 @@ android { minSdk = libs.versions.minSdk.get().toInt() targetSdk = libs.versions.targetSdk.get().toInt() versionCode = 1 + // {x-release-please-start-version} versionName = "1.19.0" + // {x-release-please-end} testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled = true } diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 000000000..399cf813f --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,11 @@ +{ + "packages": { + ".": { + "release-type": "simple", + "extra-files": [ + "ApiDemos/project/java-app/build.gradle.kts", + "ApiDemos/project/kotlin-app/build.gradle.kts" + ] + } + } +} \ No newline at end of file