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

Commit 7d4f60a9 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

add gitlab CI for build and publish

parent c63dd3b3
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

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

stages:
  - update-from-upstream
  - build
  - publish

include:
  - project: 'e/templates'
    ref: master
    file: '/gitlab-ci/.gitlab-ci-import-updates-from-upstream.yml'

upstream_main:
  extends: .update-from-upstream
  image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest
  variables:
    UPSTREAM_BRANCH: main
    LOCAL_BRANCH: master

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

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

build:
  stage: build
  script:
    - ./gradlew assemble
  artifacts:
    paths:
      - build/libs/

publish:
  stage: publish
  script:
    - ./gradlew publish
  when: manual
  
+7 −10
Original line number Diff line number Diff line

[![License](https://img.shields.io/github/license/bitfireAT/dav4jvm)](https://github.com/bitfireAT/dav4jvm/blob/main/LICENSE)
[![Tests](https://github.com/bitfireAT/dav4jvm/actions/workflows/test.yml/badge.svg)](https://github.com/bitfireAT/dav4jvm/actions/workflows/test.yml)
[![JitPack](https://img.shields.io/jitpack/v/github/bitfireAT/dav4jvm)](https://jitpack.io/#bitfireAT/dav4jvm)
[![GitLab Package Registry](https://img.shields.io/badge/packages-GitLab-informational)](https://gitlab.e.foundation/e/os/dav4jvm/-/packages)
[![KDoc](https://img.shields.io/badge/documentation-KDoc-informational)](https://bitfireat.github.io/dav4jvm/)


@@ -10,7 +10,7 @@
dav4jvm is a WebDAV/CalDAV/CardDAV library for JVM (Java/Kotlin). It has
been developed for [DAVx⁵](https://www.davx5.com) initially.

Repository: https://github.com/bitfireAT/dav4jvm/
Repository: https://gitlab.e.foundation/e/os/dav4jvm/

Generated KDoc: https://bitfireat.github.io/dav4jvm/

@@ -30,16 +30,15 @@ in your own repository and send a pull request.

## Installation

You can use jitpack.io to include dav4jvm:
You can use the GitLab Maven package registry to include dav4jvm:

    allprojects {
    repositories {
            maven { url 'https://jitpack.io' }
        maven {
            url = uri("https://gitlab.e.foundation/api/v4/projects/1687/packages/maven")
        }
    }
    dependencies {
        implementation 'com.github.bitfireAT:dav4jvm:<tag or commit>'  // usually the latest commit ID from main branch
        //implementation 'com.github.bitfireAT:dav4jvm:main-SNAPSHOT'  // use it only for testing because it doesn't generate reproducible builds
        implementation("foundation.e.bitfireAT:dav4jvm:<version>")
    }

dav4jvm needs a working XmlPullParser (XPP). On Android, the system already comes with
@@ -106,5 +105,3 @@ For specific use-cases, we have a list of forks that cover them:
## Contact / License

dav4jvm is licensed under [Mozilla Public License, v. 2.0](LICENSE).

+49 −6
Original line number Diff line number Diff line
@@ -9,14 +9,18 @@
 */

import org.jetbrains.dokka.gradle.DokkaTask
import org.gradle.api.credentials.HttpHeaderCredentials
import org.gradle.authentication.http.HttpHeaderAuthentication
import java.net.URI

repositories {
    mavenCentral()
}

group="com.github.bitfireAT"
version=System.getenv("GIT_COMMIT")     // set by jitpack.io
group = "foundation.e.bitfireAT"
version = System.getenv("CI_COMMIT_SHORT_SHA")
    ?: System.getenv("GIT_COMMIT")
    ?: "dev-SNAPSHOT"

plugins {
    alias(libs.plugins.kotlin.jvm)
@@ -25,18 +29,57 @@ plugins {
    alias(libs.plugins.dokka)
}

java {
    withSourcesJar()
}

publishing {
    publications {
        create<MavenPublication>("maven") {
        create<MavenPublication>("jar") {
            from(components["java"])
            groupId = project.group.toString()
            artifactId = "dav4jvm"
            version = project.version.toString()

            pom {
                name.set("dav4jvm")
                description.set("WebDAV, CalDAV and CardDAV library for JVM (Java/Kotlin).")
                url.set("https://gitlab.e.foundation/e/os/dav4jvm")

                licenses {
                    license {
                        name.set("Mozilla Public License Version 2.0")
                        url.set("https://mozilla.org/MPL/2.0/")
                    }
                }

                scm {
                    url.set("https://gitlab.e.foundation/e/os/dav4jvm")
                    connection.set("scm:git:https://gitlab.e.foundation/e/os/dav4jvm.git")
                    developerConnection.set("scm:git:ssh://git@gitlab.e.foundation/e/os/dav4jvm.git")
                }
            }
        }
    }

    repositories {
        maven {
            name = "dav4jvm"
            name = "BuildDir"
            url = uri(layout.buildDirectory.dir("repo"))
        }

        maven {
            name = "GitLabPackageRegistry"
            url = uri("https://gitlab.e.foundation/api/v4/projects/1687/packages/maven")

            credentials(HttpHeaderCredentials::class) {
                name = "Job-Token"
                value = System.getenv("CI_JOB_TOKEN")
            }
            authentication {
                create<HttpHeaderAuthentication>("header")
            }
        }
    }
}

@@ -46,7 +89,7 @@ tasks.withType<DokkaTask>().configureEach {
            moduleName.set("dav4jvm")
            sourceLink {
                localDirectory.set(file("src/main/kotlin"))
                remoteUrl.set(URI("https://github.com/bitfireAT/dav4jvm/tree/main/src/main/kotlin/").toURL())
                remoteUrl.set(URI("https://gitlab.e.foundation/e/os/dav4jvm/-/tree/main/src/main/kotlin/").toURL())
                remoteLineSuffix.set("#L")
            }
        }