Skip to content

Commit 15dd4fa

Browse files
Merge pull request #58 from wajahatkarim3/release/3.0.3
Moved EasyFlipView to MavenCentral. Fixed #52 #55 #57 and #54
2 parents f0999de + 7710f4d commit 15dd4fa

File tree

6 files changed

+186
-48
lines changed

6 files changed

+186
-48
lines changed

.github/publish_to_maven_central.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish
2+
on:
3+
release:
4+
# We'll run this workflow when a new GitHub release is created
5+
types: [released]
6+
7+
jobs:
8+
publish:
9+
name: Release build and publish
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v2
14+
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v2
17+
with:
18+
distribution: adopt
19+
java-version: 11
20+
21+
# Builds the release artifacts of the library
22+
- name: Release build
23+
run: ./gradlew :stream-chat-android-client:assembleRelease
24+
25+
# Generates other artifacts (javadocJar is optional)
26+
- name: Source jar and dokka
27+
run: ./gradlew androidSourcesJar javadocJar
28+
29+
# Runs upload, and then closes & releases the repository
30+
- name: Publish to MavenCentral
31+
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository
32+
env:
33+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
34+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
35+
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
36+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
37+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
38+
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}

EasyFlipView/build.gradle

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,19 @@
11
apply plugin: 'com.android.library'
2-
apply plugin: 'com.jfrog.bintray'
3-
apply plugin: 'com.github.dcendents.android-maven'
42

53
ext {
6-
/*
7-
PUBLISH_GROUP_ID = 'com.wajahatkarim3.EasyFlipView'
4+
PUBLISH_GROUP_ID = 'com.wajahatkarim'
85
PUBLISH_ARTIFACT_ID = 'EasyFlipView'
9-
PUBLISH_VERSION = '3.0.0'
10-
*/
11-
12-
bintrayRepo = "EasyFlipView"
13-
bintrayName = "com.wajahatkarim3.EasyFlipView"
14-
15-
publishedGroupId = 'com.wajahatkarim3.EasyFlipView'
16-
libraryName = 'EasyFlipView'
17-
artifact = 'EasyFlipView'
18-
19-
libraryDescription = 'A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.'
20-
21-
siteUrl = 'https://github.com/wajahatkarim3/EasyFlipView'
22-
gitUrl = 'https://github.com/wajahatkarim3/EasyFlipView.git'
23-
24-
libraryVersion = '3.0.0'
25-
26-
developerId = 'wajahatkarim3'
27-
developerName = 'Wajahat Karim'
28-
developerEmail = 'wajahatkarim3@gmail.com'
29-
30-
licenseName = 'The Apache Software License, Version 2.0'
31-
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
32-
allLicenses = ["Apache-2.0"]
6+
PUBLISH_VERSION = '3.0.3'
7+
PUBLISH_DESCRIPTION = 'A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.'
8+
PUBLISH_URL = 'https://github.com/wajahatkarim3/EasyFlipView'
9+
PUBLISH_LICENSE_NAME = 'Apache License'
10+
PUBLISH_LICENSE_URL = 'https://github.com/wajahatkarim3/EasyFlipView/blob/master/LICENSE'
11+
PUBLISH_DEVELOPER_ID = 'wajahatkarim'
12+
PUBLISH_DEVELOPER_NAME = 'Wajahat Karim'
13+
PUBLISH_DEVELOPER_EMAIL = 'wajahatkarim3@mail.com'
14+
PUBLISH_SCM_CONNECTION = 'scm:git:github.com/wajahatkarim3/EasyFlipView.git'
15+
PUBLISH_SCM_DEVELOPER_CONNECTION = 'scm:git:ssh://github.com/wajahatkarim3/EasyFlipView.git'
16+
PUBLISH_SCM_URL = 'https://github.com/wajahatkarim3/EasyFlipView/tree/master'
3317
}
3418

3519
android {
@@ -66,15 +50,4 @@ dependencies {
6650
testImplementation 'junit:junit:4.12'
6751
}
6852

69-
// or use the remote copy to keep update with latest changes
70-
//apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
71-
72-
//apply from: 'android-release-aar.gradle'
73-
//apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
74-
75-
//Add these lines to publish library to bintray. This is the readymade scripts made by github user nuuneoi to make uploading to bintray easy.
76-
//Place it at the end of the file
77-
if (project.rootProject.file('local.properties').exists()) {
78-
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
79-
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
80-
}
53+
apply from: "${rootDir}/scripts/publish-module.gradle"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Changes exist in the [releases](https://github.com/wajahatkarim3/EasyFlipView/re
3030
Add this in your app's `build.gradle` file:
3131
```groovy
3232
dependencies {
33-
implementation 'com.wajahatkarim3.EasyFlipView:EasyFlipView:3.0.0'
33+
implementation 'com.wajahatkarim:EasyFlipView:3.0.3'
3434
}
3535
```
3636

@@ -40,9 +40,9 @@ Or add EasyFlipView as a new dependency inside your pom.xml
4040

4141
```xml
4242
<dependency>
43-
<groupId>com.wajahatkarim3.EasyFlipView</groupId>
43+
<groupId>com.wajahatkarim</groupId>
4444
<artifactId>EasyFlipView</artifactId>
45-
<version>3.0.0</version>
45+
<version>3.0.3</version>
4646
<type>pom</type>
4747
</dependency>
4848
```

build.gradle

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,28 @@ buildscript {
33
ext.supportVersion = '28.0.0'
44

55
repositories {
6+
maven { url "https://plugins.gradle.org/m2/" }
67
google()
7-
jcenter()
8+
mavenCentral()
89
}
910

1011
dependencies {
11-
classpath 'com.android.tools.build:gradle:4.1.0'
12-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
13-
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
12+
classpath 'com.android.tools.build:gradle:4.1.3'
13+
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
1414
}
1515
}
1616

17+
apply plugin: 'io.github.gradle-nexus.publish-plugin'
18+
19+
1720
allprojects {
1821
repositories {
1922
google()
20-
jcenter()
23+
mavenCentral()
2124
}
2225
}
2326

2427
task clean(type: Delete) {
2528
delete rootProject.buildDir
2629
}
30+
apply from: "${rootDir}/scripts/publish-root.gradle"

scripts/publish-module.gradle

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
apply plugin: 'maven-publish'
2+
apply plugin: 'signing'
3+
4+
task androidSourcesJar(type: Jar) {
5+
archiveClassifier.set('sources')
6+
if (project.plugins.findPlugin("com.android.library")) {
7+
// For Android libraries
8+
from android.sourceSets.main.java.srcDirs
9+
// from android.sourceSets.main.kotlin.srcDirs
10+
} else {
11+
// For pure Kotlin libraries, in case you have them
12+
from sourceSets.main.java.srcDirs
13+
// from sourceSets.main.kotlin.srcDirs
14+
}
15+
}
16+
17+
artifacts {
18+
archives androidSourcesJar
19+
}
20+
21+
group = PUBLISH_GROUP_ID
22+
version = PUBLISH_VERSION
23+
24+
afterEvaluate {
25+
publishing {
26+
publications {
27+
release(MavenPublication) {
28+
// The coordinates of the library, being set from variables that
29+
// we'll set up later
30+
groupId PUBLISH_GROUP_ID
31+
artifactId PUBLISH_ARTIFACT_ID
32+
version PUBLISH_VERSION
33+
34+
// Two artifacts, the `aar` (or `jar`) and the sources
35+
if (project.plugins.findPlugin("com.android.library")) {
36+
from components.release
37+
} else {
38+
from components.java
39+
}
40+
41+
artifact androidSourcesJar
42+
// artifact javadocJar
43+
44+
// Mostly self-explanatory metadata
45+
pom {
46+
name = PUBLISH_ARTIFACT_ID
47+
description = PUBLISH_DESCRIPTION
48+
url = PUBLISH_URL
49+
licenses {
50+
license {
51+
name = PUBLISH_LICENSE_NAME
52+
url = PUBLISH_LICENSE_URL
53+
}
54+
}
55+
developers {
56+
developer {
57+
id = PUBLISH_DEVELOPER_ID
58+
name = PUBLISH_DEVELOPER_NAME
59+
email = PUBLISH_DEVELOPER_EMAIL
60+
}
61+
// Add all other devs here...
62+
}
63+
64+
// Version control info - if you're using GitHub, follow the
65+
// format as seen here
66+
scm {
67+
connection = PUBLISH_SCM_CONNECTION
68+
developerConnection = PUBLISH_SCM_DEVELOPER_CONNECTION
69+
url = PUBLISH_SCM_URL
70+
}
71+
}
72+
}
73+
}
74+
}
75+
}
76+
77+
signing {
78+
useInMemoryPgpKeys(
79+
rootProject.ext["signing.keyId"],
80+
rootProject.ext["signing.key"],
81+
rootProject.ext["signing.password"],
82+
)
83+
sign publishing.publications
84+
}

scripts/publish-root.gradle

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Create variables with empty default values
2+
// Create variables with empty default values
3+
ext["ossrhUsername"] = ''
4+
ext["ossrhPassword"] = ''
5+
ext["sonatypeStagingProfileId"] = ''
6+
ext["signing.keyId"] = ''
7+
ext["signing.password"] = ''
8+
ext["signing.key"] = ''
9+
ext["snapshot"] = ''
10+
11+
File secretPropsFile = project.rootProject.file('local.properties')
12+
if (secretPropsFile.exists()) {
13+
// Read local.properties file first if it exists
14+
Properties p = new Properties()
15+
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
16+
p.each { name, value -> ext[name] = value }
17+
} else {
18+
// Use system environment variables
19+
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
20+
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
21+
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
22+
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
23+
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
24+
ext["signing.key"] = System.getenv('SIGNING_KEY')
25+
}
26+
27+
// Set up Sonatype repository
28+
nexusPublishing {
29+
repositories {
30+
sonatype {
31+
stagingProfileId = sonatypeStagingProfileId
32+
username = ossrhUsername
33+
password = ossrhPassword
34+
// Add these lines if using new Sonatype infra
35+
// nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
36+
// snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)