diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..251d59e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,54 @@ +name: Release +on: + push: + tags: + - 'v*' + +jobs: + publish: + name: Release Openfeature SDK + runs-on: ubuntu-latest + + steps: + - name: Cache Gradle and wrapper + 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 + + - name: Set up JDK 12 + uses: actions/setup-java@v1 + with: + java-version: 12 + + - name: Grant Permission for Gradlew to Execute + run: chmod +x gradlew + + - name: Build AAR ⚙️🛠 + run: bash ./gradlew :openfeature:assemble + - name: Create Release ✅ + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.TOKEN_PUBLISH }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: true + prerelease: false + + - name: Upload Openfeature SDK AAR 🗳 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.TOKEN_PUBLISH }} + 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 c1bdd10..e9374ca 100644 --- a/OpenFeature/build.gradle.kts +++ b/OpenFeature/build.gradle.kts @@ -1,3 +1,4 @@ +// ktlint-disable max-line-length plugins { id("com.android.library") id("org.jetbrains.kotlin.android") @@ -33,12 +34,6 @@ android { kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() } - publishing { - singleVariant("release") { - withSourcesJar() - withJavadocJar() - } - } } dependencies { @@ -48,16 +43,31 @@ dependencies { testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1") } -publishing { - publications { - register("release") { - groupId = "dev.openfeature" - artifactId = "kotlin-sdk" - version = "0.0.1-SNAPSHOT" +afterEvaluate { + publishing { + publications { + register("release") { + groupId = "dev.openfeature" + artifactId = "kotlin-sdk" + version = "0.0.1-SNAPSHOT" - afterEvaluate { from(components["release"]) + artifact(androidSourcesJar.get()) + + pom { + name.set("OpenfeatureSDK") + } } } } +} + +val androidSourcesJar by tasks.registering(Jar::class) { + archiveClassifier.set("sources") + from(android.sourceSets.getByName("main").java.srcDirs) +} + +// Assembling should be performed before publishing package +tasks.named("publish") { + dependsOn("assemble") } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 9c79167..7c1df9e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,6 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id("com.android.library").version("7.4.1").apply(false) + id("com.android.library").version("7.4.2").apply(false) id("org.jetbrains.kotlin.android").version("1.8.0").apply(false) id("org.jlleitschuh.gradle.ktlint").version("11.3.2").apply(true) } \ No newline at end of file diff --git a/jitpack.yaml b/jitpack.yaml new file mode 100644 index 0000000..46c8529 --- /dev/null +++ b/jitpack.yaml @@ -0,0 +1,2 @@ +jdk: + - openjdk11 \ No newline at end of file