From 9b499962602a2290ab0bb8b026d3efbbfafd8ef6 Mon Sep 17 00:00:00 2001 From: vahid torkaman Date: Fri, 18 Aug 2023 10:14:19 +0200 Subject: [PATCH] feat: add jitpack openjdk. add release_please integration Signed-off-by: vahid torkaman Signed-off-by: vahid torkaman --- .github/workflows/release_please.yaml | 71 +++++++++++++++++++++++++++ OpenFeature/build.gradle.kts | 6 ++- OpenFeature/jitpack.yaml | 2 + 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release_please.yaml create mode 100644 OpenFeature/jitpack.yaml diff --git a/.github/workflows/release_please.yaml b/.github/workflows/release_please.yaml new file mode 100644 index 0000000..71d3cd8 --- /dev/null +++ b/.github/workflows/release_please.yaml @@ -0,0 +1,71 @@ +on: + push: + branches: + - main + +name: Run Release Please +jobs: + release-please: + runs-on: ubuntu-latest + + # Release-please creates a PR that tracks all changes + steps: + - uses: google-github-actions/release-please-action@ca6063f4ed81b55db15b8c42d1b6f7925866342d # v3 + id: release + with: + command: manifest + token: ${{secrets.GITHUB_TOKEN}} + default-branch: main + + # The logic below handles the github release: + - name: Cache Gradle and wrapper + if: ${{ steps.release.outputs.releases_created }} + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - uses: actions/checkout@v1 + if: ${{ steps.release.outputs.releases_created }} + + - name: Set up JDK 11 + if: ${{ steps.release.outputs.releases_created }} + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Grant Permission for Gradlew to Execute + if: ${{ steps.release.outputs.releases_created }} + run: chmod +x gradlew + + - name: Build AAR ⚙️🛠 + if: ${{ steps.release.outputs.releases_created }} + env: + OF_KOTLIN_RELEASE_VERSION: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} + run: bash ./gradlew :openfeature:assemble + + - name: Create Release ✅ + id: create_release + uses: actions/create-release@v1 + env: + OF_KOTLIN_RELEASE_VERSION: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + tag_name: ${{ env.OF_KOTLIN_RELEASE_VERSION }} + release_name: ${{ env.OF_KOTLIN_RELEASE_VERSION }} + draft: false + prerelease: false + + - name: Upload Openfeature SDK AAR 🗳 + if: ${{ steps.release.outputs.releases_created }} + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: OpenFeature/build/outputs/aar/OpenFeature-release.aar + asset_name: openfeature-sdk.aar + asset_content_type: application/aar \ No newline at end of file diff --git a/OpenFeature/build.gradle.kts b/OpenFeature/build.gradle.kts index 3e198d5..07f3aff 100644 --- a/OpenFeature/build.gradle.kts +++ b/OpenFeature/build.gradle.kts @@ -7,13 +7,15 @@ plugins { kotlin("plugin.serialization") version "1.8.10" } +val releaseVersion = System.getenv("OF_KOTLIN_RELEASE_VERSION") ?: "0.0.1-SNAPSHOT" + android { namespace = "dev.openfeature.sdk" compileSdk = 33 defaultConfig { minSdk = 21 - version = "0.0.1" + version = releaseVersion testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @@ -50,7 +52,7 @@ afterEvaluate { register("release") { groupId = "dev.openfeature" artifactId = "kotlin-sdk" - version = "0.0.1-SNAPSHOT" + version = releaseVersion from(components["release"]) artifact(androidSourcesJar.get()) diff --git a/OpenFeature/jitpack.yaml b/OpenFeature/jitpack.yaml new file mode 100644 index 0000000..46c8529 --- /dev/null +++ b/OpenFeature/jitpack.yaml @@ -0,0 +1,2 @@ +jdk: + - openjdk11 \ No newline at end of file