Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60e2b061 authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

1720-Publish lib to e gitlab repo

parent 40b2e026
Loading
Loading
Loading
Loading
+23 −5
Original line number Diff line number Diff line
image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:1263-Add_java_17_support"
image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:master"

stages:
  - lib
  - build
  - publish

before_script:
  - export GRADLE_USER_HOME=$(pwd)/.gradle
@@ -12,10 +13,27 @@ cache:
  paths:
    - .gradle/

lib:
  stage: lib
build:
  stage: build
  rules:
    - if: '$CI_COMMIT_TAG !~ "/^$/"'
      when: always
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: manual
  script:
    - ./gradlew :ical4android:assembleRelease
    - ./gradlew build
  artifacts:
    paths:
      - lib/build/outputs/aar/

publish:
  stage: publish
  needs:
    - build
  rules:
    - if: '$CI_COMMIT_TAG !~ "/^$/"'
      when: always
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: manual
  script:
    - ./gradlew publish
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx4g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true

# configuration cache [https://developer.android.com/build/optimize-your-build#use-the-configuration-cache-experimental]
org.gradle.unsafe.configuration-cache=true
org.gradle.unsafe.configuration-cache=false
org.gradle.unsafe.configuration-cache-problems=warn

# Android
+38 −5
Original line number Diff line number Diff line
@@ -9,8 +9,16 @@ plugins {
    id("org.jetbrains.dokka")
}


val version_ical4j = "3.2.11"

val versionMajor = 1
val versionMinor = 1
val versionPatch = 1

val versionName = "${versionMajor}.${versionMinor}.${versionPatch}"
val baseName = "ical4android-$versionName"

android {
    compileSdk = 33

@@ -26,6 +34,8 @@ android {
        aarMetadata {
            minCompileSdk = 29
        }

        setProperty("archivesBaseName", baseName)
    }

    compileOptions {
@@ -71,13 +81,36 @@ android {
publishing {
    // Configure publishing data
    publications {
        register("release", MavenPublication::class.java) {
            groupId = "com.github.bitfireAT"
        create<MavenPublication>("maven") {
            groupId = "foundation.e.lib"
            artifactId = "ical4android"
            version = System.getenv("GIT_COMMIT")
            version = versionName
            artifact("$buildDir/outputs/aar/$baseName-release.aar")

            afterEvaluate {
                from(components["release"])
            pom.withXml {
                val dependenciesNode = asNode().appendNode("dependencies")
                configurations["implementation"].dependencies.forEach { dependency ->
                    if (dependency.name != "unspecified") {
                        val dependencyNode = dependenciesNode.appendNode("dependency")
                        dependencyNode.appendNode("groupId", dependency.group)
                        dependencyNode.appendNode("artifactId", dependency.name)
                        dependencyNode.appendNode("version", dependency.version)
                    }
                }
            }

            repositories {
                maven {
                    url = uri("https://gitlab.e.foundation/api/v4/projects/97/packages/maven")
                    name = "GitLab"
                    credentials(HttpHeaderCredentials::class) {
                        name = "Job-Token"
                        value = System.getenv("CI_JOB_TOKEN")
                    }
                    authentication {
                        create("header", HttpHeaderAuthentication::class)
                    }
                }
            }
        }
    }