Skip to content

Commit

Permalink
Merge pull request #36 from leandroBorgesFerreira/Publish
Browse files Browse the repository at this point in the history
Publish
  • Loading branch information
leandroBorgesFerreira authored May 23, 2023
2 parents 25d5b6f + 672aba0 commit c0999cb
Show file tree
Hide file tree
Showing 102 changed files with 550 additions and 388 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish

on:
release:
types: [released]

jobs:
publish:
name: Release build and publish
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
- name: Set up JDK 17
uses: actions/[email protected]
with:
distribution: adopt
java-version: '17'
- name: Release build
run: ./gradlew assembleRelease --scan
- name: Publish to MavenCentral
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 --scan
env:
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package br.com.leandroferreira.app_sample.data

import android.content.Context
import br.com.leandroferreira.app_sample.R
import br.com.leandroferreira.storyteller.model.story.StoryStep
import br.com.leandroferreira.storyteller.model.story.StoryUnit
import com.github.leandroferreira.storyteller.model.story.StoryStep
import com.github.leandroferreira.storyteller.model.story.StoryUnit
import java.util.UUID

fun messages(): List<StoryUnit> = buildList {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import br.com.leandroferreira.app_sample.screens.note.NoteDetailsScreen
import br.com.leandroferreira.app_sample.screens.note.NoteDetailsViewModel
import br.com.leandroferreira.app_sample.screens.note.NoteDetailsViewModelFactory
import br.com.leandroferreira.app_sample.theme.ApplicationComposeTheme
import br.com.leandroferreira.storyteller.persistence.repository.DocumentRepository
import br.com.leandroferreira.storyteller.VideoFrameConfig
import br.com.leandroferreira.storyteller.manager.StoryTellerManager
import br.com.leandroferreira.storyteller.persistence.database.StoryTellerDatabase
import com.github.leandroferreira.storyteller.persistence.repository.DocumentRepository
import com.github.leandroferreira.storyteller.VideoFrameConfig
import com.github.leandroferreira.storyteller.manager.StoryTellerManager
import com.github.leandroferreira.storyteller.persistence.database.StoryTellerDatabase

class NavigationActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import br.com.leandroferreira.storyteller.StoryTellerTimeline
import br.com.leandroferreira.storyteller.drawer.DefaultDrawers
import com.github.leandroferreira.storyteller.StoryTellerTimeline
import com.github.leandroferreira.storyteller.drawer.DefaultDrawers


@OptIn(ExperimentalMaterial3Api::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package br.com.leandroferreira.app_sample.screens.addstory

import android.content.Context
import br.com.leandroferreira.app_sample.data.syncHistory
import br.com.leandroferreira.storyteller.model.story.StoryUnit
import br.com.leandroferreira.storyteller.persistence.dao.DocumentDao
import com.github.leandroferreira.storyteller.model.story.StoryUnit
import com.github.leandroferreira.storyteller.persistence.dao.DocumentDao

class StoriesRepo(
private val context: Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package br.com.leandroferreira.app_sample.screens.addstory

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import br.com.leandroferreira.storyteller.manager.StoryTellerManager
import br.com.leandroferreira.storyteller.model.story.StoryState
import com.github.leandroferreira.storyteller.manager.StoryTellerManager
import com.github.leandroferreira.storyteller.model.story.StoryState
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package br.com.leandroferreira.app_sample.screens.menu
import android.content.Context
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import br.com.leandroferreira.storyteller.persistence.parse.toModel
import com.github.leandroferreira.storyteller.persistence.parse.toModel
import br.com.leandroferreira.app_sample.utils.ResultData
import br.com.leandroferreira.storyteller.model.document.Document
import com.github.leandroferreira.storyteller.model.document.Document
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package br.com.leandroferreira.app_sample.screens.menu
import android.content.Context
import br.com.leandroferreira.app_sample.data.supermarketList
import br.com.leandroferreira.app_sample.data.syncHistory
import br.com.leandroferreira.storyteller.persistence.parse.toEntity
import br.com.leandroferreira.storyteller.persistence.dao.DocumentDao
import br.com.leandroferreira.storyteller.persistence.dao.StoryUnitDao
import br.com.leandroferreira.storyteller.persistence.entity.document.DocumentEntity
import com.github.leandroferreira.storyteller.persistence.parse.toEntity
import com.github.leandroferreira.storyteller.persistence.dao.DocumentDao
import com.github.leandroferreira.storyteller.persistence.dao.StoryUnitDao
import com.github.leandroferreira.storyteller.persistence.entity.document.DocumentEntity
import java.util.UUID

class NotesRepository(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import br.com.leandroferreira.app_sample.R
import br.com.leandroferreira.app_sample.screens.note.input.InputScreen
import br.com.leandroferreira.app_sample.theme.BACKGROUND_VARIATION
import br.com.leandroferreira.app_sample.theme.BACKGROUND_VARIATION_DARK
import br.com.leandroferreira.storyteller.StoryTellerTimeline
import br.com.leandroferreira.storyteller.drawer.DefaultDrawers
import br.com.leandroferreira.storyteller.model.document.Document
import com.github.leandroferreira.storyteller.StoryTellerTimeline
import com.github.leandroferreira.storyteller.drawer.DefaultDrawers
import com.github.leandroferreira.storyteller.model.document.Document
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.collectLatest
import java.util.UUID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package br.com.leandroferreira.app_sample.screens.note
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewModelScope
import br.com.leandroferreira.storyteller.backstack.BackstackHandler
import br.com.leandroferreira.storyteller.backstack.BackstackInform
import br.com.leandroferreira.storyteller.manager.StoryTellerManager
import br.com.leandroferreira.storyteller.model.document.Document
import br.com.leandroferreira.storyteller.model.story.StoryState
import br.com.leandroferreira.storyteller.persistence.repository.DocumentRepository
import com.github.leandroferreira.storyteller.backstack.BackstackHandler
import com.github.leandroferreira.storyteller.backstack.BackstackInform
import com.github.leandroferreira.storyteller.manager.StoryTellerManager
import com.github.leandroferreira.storyteller.model.document.Document
import com.github.leandroferreira.storyteller.model.story.StoryState
import com.github.leandroferreira.storyteller.persistence.repository.DocumentRepository
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
Expand Down
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ plugins {
id("com.android.library") version "8.0.1" apply false
id("org.jetbrains.kotlin.android") version "1.8.21" apply false
id("com.google.devtools.ksp") version "1.8.21-1.0.11" apply false
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id("org.jetbrains.dokka") version "1.8.10"
}
apply(from = "${rootDir}/scripts/publish-root.gradle")
80 changes: 80 additions & 0 deletions scripts/publish-module.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.jetbrains.dokka'

group = PUBLISH_GROUP_ID
version = PUBLISH_VERSION

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')

from android.sourceSets.main.java.srcDirs
from android.sourceSets.main.kotlin.srcDirs
}

tasks.withType(dokkaHtmlPartial.getClass()).configureEach {
pluginsMapConfiguration.set(
["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
)
}

task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
archiveClassifier.set('javadoc')
from dokkaJavadoc.outputDirectory
}

artifacts {
archives androidSourcesJar
archives javadocJar
}

afterEvaluate { project ->
publishing {
publications {
release(MavenPublication) {
groupId "com.github.leandroborgesferreira"
artifactId PUBLISH_ARTIFACT_ID
version PUBLISH_VERSION

from components.release

artifact androidSourcesJar
artifact javadocJar

pom {
name = "storyteller"
description = "A library to create complex text editors inside apps"
url = 'https://https://github.com/leandroBorgesFerreira/StoryTeller'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'leandroBorgesFerreira'
name = 'Leandro Borges Ferreira'
email = "[email protected]"
url = "https://github.com/leandroBorgesFerreira"
}
}
scm {
connection = "scm:[email protected]:leandroBorgesFerreira/StoryTeller.git"
developerConnection = "scm:git:ssh://github.com/leandroBorgesFerreira/StoryTeller.git"
url = "https://github.com/leandroBorgesFerreira/StoryTeller"
}
}
}
}
}
}

signing {
useInMemoryPgpKeys(
rootProject.ext["signing.keyId"],
rootProject.ext["signing.key"],
rootProject.ext["signing.password"],
)
sign publishing.publications
}
35 changes: 35 additions & 0 deletions scripts/publish-root.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Create variables with empty default values
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
ext["sonatypeStagingProfileId"] = ''
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.key"] = ''
ext["snapshot"] = ''

File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
// Read local.properties file first if it exists
Properties p = new Properties()
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
p.each { name, value -> ext[name] = value }
} else {
// Use system environment variables
ext["ossrhUsername"] = System.getenv('SONATYPE_NEXUS_USERNAME')
ext["ossrhPassword"] = System.getenv('SONATYPE_NEXUS_PASSWORD')
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
ext["signing.key"] = System.getenv('SIGNING_KEY')
ext["snapshot"] = System.getenv('SNAPSHOT')
}

nexusPublishing {
repositories {
sonatype {
stagingProfileId = sonatypeStagingProfileId
username = ossrhUsername
password = ossrhPassword
}
}
}
13 changes: 12 additions & 1 deletion storyteller/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ plugins {
id("org.jetbrains.kotlin.android")
}

rootProject.extra.apply {
set("PUBLISH_GROUP_ID", "com.github.leandroborgesferreira")
set("PUBLISH_ARTIFACT_ID", "storyteller")
set("PUBLISH_VERSION", "0.1.0")
}

apply(from = "${rootDir}/scripts/publish-module.gradle")

android {
namespace = "br.com.leandroferreira.storyteller"
namespace = "com.github.leandroferreira.storyteller"
compileSdk = 33

defaultConfig {
Expand Down Expand Up @@ -36,6 +44,9 @@ android {
composeOptions {
kotlinCompilerExtensionVersion = "1.4.7"
}
publishing {
singleVariant("release")
}
}

kotlin{
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit c0999cb

Please sign in to comment.