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

Commit

Permalink
Merge pull request #25 from spotify/release-pipeline
Browse files Browse the repository at this point in the history
add the publishing to gpr and release pipeline
  • Loading branch information
vahidlazio committed Jul 12, 2023
2 parents d6ab025 + 6fb8230 commit af8d6cb
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 14 deletions.
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"

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

0 comments on commit af8d6cb

Please sign in to comment.