Skip to content

Commit 57879b8

Browse files
authored
Merge pull request #82 from AppDevNext/PublishMavenCentralVanniktech
Publish to MavenCentral [stage only]
2 parents 2a281ac + 8e77407 commit 57879b8

File tree

7 files changed

+84
-27
lines changed

7 files changed

+84
-27
lines changed

.github/workflows/Android-CI-release.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install Android SDK
3030
uses: malinskiy/action-android/install-sdk@release/0.1.4
3131
- name: Build project
32-
run: ./gradlew clean build
32+
run: ./gradlew assembleRelease
3333
env:
3434
VERSION: ${{ github.ref }}
3535

@@ -49,3 +49,11 @@ jobs:
4949
env:
5050
GITHUBACTOR: ${{ secrets.GITHUBACTOR }}
5151
GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}
52+
53+
- name: Publish mavenCentral (stage)
54+
run: |
55+
signing/decrypt.sh
56+
cat signing/gradle_secure.properties >> gradle.properties
57+
./gradlew publish MPChartLib:publishMavenPublicationToMavenCentralRepository
58+
env:
59+
CRYPT_PASS: ${{ secrets.CRYPT_PASS }}

MPChartLib/build.gradle

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id 'com.android.library'
33
id 'maven-publish'
4+
id "com.vanniktech.maven.publish" version "0.22.0"
45
}
56

67
ext {
@@ -46,36 +47,47 @@ task androidSourcesJar(type: Jar) {
4647
from android.sourceSets.main.java.srcDirs
4748
}
4849

49-
project.afterEvaluate {
50-
publishing {
51-
publications {
52-
maven(MavenPublication) {
53-
groupId mGroupId
54-
artifactId mArtifactId
55-
version mVersionName
50+
group = "info.mxtracks"
51+
version = "${getTag()}"
52+
println "Build version $version"
5653

57-
from components.release
58-
59-
// artifact androidSourcesJar
60-
// artifact("$buildDir/outputs/aar/MPChartLib-release.aar")
61-
62-
pom {
63-
name = mLibraryName
64-
description = mLibraryDescription
65-
}
54+
mavenPublishing {
55+
pom {
56+
name = "Android Chart"
57+
description = "A powerful Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, dragging and animations"
58+
inceptionYear = "2022"
59+
url = "https://github.com/AppDevNext/AndroidChart/"
60+
licenses {
61+
license {
62+
name = "The Apache License, Version 2.0"
63+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
64+
distribution = "http://www.apache.org/licenses/LICENSE-2.0.txt"
65+
}
66+
}
67+
developers {
68+
developer {
69+
id = "AppDevNext"
70+
name = "AppDevNext"
71+
url = "https://github.com/AppDevNext/"
6672
}
6773
}
74+
scm {
75+
url = "https://github.com/AppDevNext/AndroidChart/"
76+
connection = "scm:git:git://github.com/AppDevNext/AndroidChart.git"
77+
developerConnection = "scm:git:ssh://git@github.com/AppDevNext/AndroidChart.git"
78+
}
79+
}
6880

69-
repositories {
70-
maven {
71-
version = getTag()
72-
name = "GitHubPackages"
73-
url = "https://maven.pkg.github.com/AppDevNext/AndroidChart"
74-
credentials {
75-
username = System.getenv("GITHUBACTOR")
76-
password = System.getenv("GITHUBTOKEN")
77-
}
81+
// Github packages
82+
repositories {
83+
maven {
84+
version = version+"-SNAPSHOT"
85+
name = "GitHubPackages"
86+
url = "https://maven.pkg.github.com/AppDevNext/AndroidChart"
87+
credentials {
88+
username = System.getenv("GITHUBACTOR")
89+
password = System.getenv("GITHUBTOKEN")
7890
}
7991
}
8092
}
81-
}
93+
}

gradle.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
android.enableJetifier=true
22
android.useAndroidX=true
33
org.gradle.jvmargs=-Xmx2048M
4+
5+
#SONATYPE_HOST=DEFAULT
6+
# or when publishing to https://s01.oss.sonatype.org
7+
SONATYPE_HOST=S01
8+
RELEASE_SIGNING_ENABLED=true
9+
POM_ARTIFACT_ID=chart

signing/cleanup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
find . -name '*.gpg' |xargs rm

signing/decrypt.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ -z "$CRYPT_PASS" ]]
4+
then
5+
read -sp 'Password: ' CRYPT_PASS
6+
if [[ -z "$CRYPT_PASS" ]]
7+
then
8+
echo "\$CRYPT_PASS Still empty"
9+
exit 1
10+
fi
11+
else
12+
echo "\$CRYPT_PASS available"
13+
fi
14+
15+
pushd signing
16+
17+
# to encrypt
18+
#openssl aes-256-cbc -salt -pbkdf2 -salt -k "$CRYPT_PASS" -in secring.gpg -out secring.gpg.enc
19+
#openssl aes-256-cbc -salt -pbkdf2 -salt -k "$CRYPT_PASS" -in gradle_secure.properties -out gradle_secure.properties.enc
20+
21+
# Ubuntu 18.04 (openssl 1.1.0g+) needs -md md5
22+
# https://askubuntu.com/questions/1067762/unable-to-decrypt-text-files-with-openssl-on-ubuntu-18-04/1076708
23+
echo "decrypt secring.gpg"
24+
openssl aes-256-cbc -d -salt -pbkdf2 -k "$CRYPT_PASS" -in secring.gpg.enc -out secring.gpg
25+
echo "decrypt gradle_secure.properties"
26+
openssl aes-256-cbc -d -salt -pbkdf2 -k "$CRYPT_PASS" -in gradle_secure.properties.enc -out gradle_secure.properties
27+
28+
popd 1>/dev/null
240 Bytes
Binary file not shown.

signing/secring.gpg.enc

8.41 KB
Binary file not shown.

0 commit comments

Comments
 (0)