Skip to content

Commit

Permalink
setting maven central
Browse files Browse the repository at this point in the history
  • Loading branch information
taewooyo committed Nov 17, 2023
1 parent 385ba89 commit aa052e6
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 16 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Android CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
lint:
name: Spotless check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
- name: Set up JDK
uses: actions/[email protected]
with:
distribution: zulu
java-version: 17
- uses: gradle/[email protected]
- name: spotless
run: ./gradlew spotlessCheck

build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: set up JDK
uses: actions/[email protected]
with:
distribution: zulu
java-version: 17

- uses: gradle/[email protected]
- name: Make Gradle executable
run: chmod +x ./gradlew

- name: Build with Gradle
run: |
./gradlew --scan --stacktrace \
assemble
38 changes: 38 additions & 0 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Snapshot builds

on:
push:
branches:
- main
workflow_dispatch:

jobs:
publish:
name: Snapshot 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: 'zulu'
java-version: 17

- name: Grant Permission to Execute Gradle
run: chmod +x gradlew

- name: Release build
run: ./gradlew assemble --scan

- name: Publish to MavenCentral
run: |
./gradlew publishAllPublicationsToMavenCentral --no-daemon --no-parallel
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
SNAPSHOT: true
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish

on:
release:
types: [ released ]
workflow_dispatch:

jobs:
publish:
name: Snapshot 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: 'zulu'
java-version: 17

- name: Grant Permission to Execute Gradle
run: chmod +x gradlew

- name: Release build
run: ./gradlew assemble --scan

- name: Publish to MavenCentral
run: |
./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
80 changes: 64 additions & 16 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,23 +1,71 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
#
# Copyright 2023 taewooyo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# https://docs.gradle.org/current/userguide/build_environment.html#sec:configuring_jvm_memory
org.gradle.jvmargs=-Xmx4g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -Dlint.nullness.ignore-deprecated=true

# https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
org.gradle.parallel=true

# Configure only necessary projects, useful with multimodule projects
org.gradle.configureondemand=true

# AndroidX Migration https://developer.android.com/jetpack/androidx/migrate
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official

# Removes uneccessary default build features
android.defaults.buildfeatures.aidl=false
android.defaults.buildfeatures.buildconfig=false
android.defaults.buildfeatures.renderscript=false
android.defaults.buildfeatures.resvalues=false
android.defaults.buildfeatures.shaders=false

# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
# https://developer.android.com/studio/releases/gradle-plugin#4.1-nontransitive-r-class
android.nonTransitiveRClass=true

## Maven Central Publication ##
systemProp.org.gradle.internal.publish.checksums.insecure=true

# Increase timeout when pushing to Sonatype (otherwise we get timeouts)
systemProp.org.gradle.internal.http.socketTimeout=120000

GROUP=io.github.taewooyo

POM_URL=https://github.com/taewooyo/shaker/
POM_SCM_URL=https://github.com/taewooyo/shaker/
POM_SCM_CONNECTION=scm:git:git://github.com/taewooyo/shaker.git
POM_SCM_DEV_CONNECTION=scm:git:git://github.com/taewooyo/shaker.git

POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo

POM_DEVELOPER_ID=taewooyo
POM_DEVELOPER_NAME=taewooyo
POM_DEVELOPER_URL=https://github.com/taewooyo/
POM_DEVELOPER_EMAIL=[email protected]

SONATYPE_HOST=S01
RELEASE_SIGNING_ENABLED=true
SONATYPE_AUTOMATIC_RELEASE=true
13 changes: 13 additions & 0 deletions scripts/publish-module.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import com.taewooyo.buildsrc.Configuration

apply(plugin = "com.vanniktech.maven.publish")

rootProject.extra.apply {
val snapshot = System.getenv("SNAPSHOT").toBoolean()
val libVersion = if (snapshot) {
Configuration.snapshotVersionName
} else {
Configuration.versionName
}
set("libVersion", libVersion)
}
17 changes: 17 additions & 0 deletions shaker/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ import com.taewooyo.buildsrc.Configuration
plugins {
id(libs.plugins.android.library.get().pluginId)
id(libs.plugins.kotlin.android.get().pluginId)
id(libs.plugins.nexus.plugin.get().pluginId)
}

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

mavenPublishing {
val artifactId = "shaker"
coordinates(
Configuration.artifactGroup,
artifactId,
rootProject.extra.get("libVersion").toString()
)

pom {
name.set(artifactId)
description.set("Modifier's optimally created rotation, translation, and zoom animations are fully customizable for Android. Only Jetpack Compose is supported.")
}
}

android {
Expand Down

0 comments on commit aa052e6

Please sign in to comment.