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

Commit e8cc789e authored by Sayantan Roychowdhury's avatar Sayantan Roychowdhury
Browse files

1111 ci build

parent 4408cdd0
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+40 −0
Original line number Diff line number Diff line
image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:1263-Add_java_17_support"

stages:
- build
- publish

before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew

cache:
  key: ${CI_PROJECT_ID}
  paths:
  - .gradle/

build:
  stage: build
  rules:
    - if: '$CI_COMMIT_TAG !~ "/^$/"'
      when: always
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: always
    - when: manual
  script:
  - ./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
+37 −7
Original line number Diff line number Diff line
import android.annotation.SuppressLint

plugins {
    id("com.android.library")
    id("org.jetbrains.kotlin.android")
@@ -7,6 +5,14 @@ plugins {
    id("maven-publish")
}

val versionMajor = 1
val versionMinor = 0
val versionPatch = 0
val releasePatch = "stable"

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

android {
    namespace = "at.bitfire.vcard4android"

@@ -18,6 +24,7 @@ android {
        aarMetadata {
            minCompileSdk = 29
        }
        setProperty("archivesBaseName", baseName)
    }

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

            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)
                    }
                }
            }

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