Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

add the publishing to gpr and release pipeline #25

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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
36 changes: 23 additions & 13 deletions OpenFeature/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ktlint-disable max-line-length
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
Expand Down Expand Up @@ -33,12 +34,6 @@ android {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
}

dependencies {
Expand All @@ -48,16 +43,31 @@ dependencies {
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1")
}

publishing {
publications {
register<MavenPublication>("release") {
groupId = "dev.openfeature"
artifactId = "kotlin-sdk"
version = "0.0.1-SNAPSHOT"
afterEvaluate {
publishing {
publications {
register<MavenPublication>("release") {
groupId = "dev.openfeature"
artifactId = "kotlin-sdk"
version = "0.0.1-SNAPSHOT"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? shouldn't we pull this from somewhere? The tag info for example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, we should think about versioning. i was thinking to start with manual versioning for now and have something released using pipeline and then add tickets for versioning. we need to refine them as well and think of a strategy how we want to version our sdks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sounds good. Just a note that we have the version duplicated both here and in android { defaultConfig {} }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on syncing Github release versions with Maven versions, once we get closer to an official Maven distribution


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")
}
2 changes: 2 additions & 0 deletions OpenFeature/jitpack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk11
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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)
}