Skip to content

Commit 1d5f7f3

Browse files
kvdevopsadminvarghese-babudevi-krishna-kv
authored
build: Add/workflow maven publish (#51)
* add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add: workflow for publishing to maven central * add:workflow for maven central publish * add:workflow for maven central publish * add:workflow for maven central publish * add:workflow for maven central publish * add: workflow for publishing to maven central --------- Co-authored-by: varghese-babu <[email protected]> Co-authored-by: Devi <[email protected]>
1 parent 2921a13 commit 1d5f7f3

File tree

2 files changed

+92
-10
lines changed

2 files changed

+92
-10
lines changed

.github/workflows/publish.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
workflow_dispatch:
5+
# workflow_dispatch:
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
id-token: write
11+
12+
steps:
13+
# Step to check out the repository's code
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
# Step to set up JDK 17, which is required for Gradle to run
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v1
20+
with:
21+
distribution: 'temurin'
22+
java-version: '17'
23+
cache: 'gradle'
24+
25+
- name: Find the location of jdk
26+
run: echo "${{ env.JAVA_HOME }}"
27+
28+
# - name: List the contents of the path java
29+
# run: cd /opt/hostedtoolcache/jdk/17.0.11/x64 | ls
30+
31+
- name: Setup Gradle
32+
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
33+
34+
# Step to grant execute permissions to the Gradle wrapper script
35+
- name: Grant execute permission for gradlew
36+
run: chmod +x gradlew
37+
38+
- name: Add new line
39+
run: echo "" >> gradle.properties
40+
41+
- name: Add java home to gradle.properties
42+
run: echo "org.gradle.java.home=${{ env.JAVA_HOME }}" >> gradle.properties
43+
44+
- name: Add signing key id to gradle.properties
45+
run: echo "signing.keyId=${{ secrets.OSS_SIGNING_KEY_ID }}" >> gradle.properties
46+
47+
- name: Add signing password to gradle.proeprties
48+
run: echo "signing.password=${{ secrets.OSS_SIGNING_PASSWORD }}" >> gradle.properties
49+
50+
- name: Add secret file loc to gradle.properties
51+
run: echo "signing.secretKeyRingFile=/home/runner/work/siren-android-inbox/siren-android-inbox/siren-sdk/secring.gpg" >> gradle.properties
52+
53+
- name: Configure AWS credentials
54+
55+
uses: aws-actions/configure-aws-credentials@v4
56+
with:
57+
aws-region: ${{ secrets.AWS_REGION }}
58+
role-to-assume: ${{ secrets.AWS_ROLE }}
59+
60+
- name: Download s3 secring file
61+
run: aws s3 cp s3://${{ secrets.BUCKET }}/secring.gpg /home/runner/work/siren-android-inbox/siren-android-inbox/siren-sdk/secring.gpg
62+
63+
# - name: cat secring.gpg
64+
# run: cat /home/runner/work/siren-android-inbox/siren-android-inbox/siren-sdk/secring.gpg
65+
66+
- name: Echo gradle.properties
67+
run: cat gradle.properties
68+
#Step to build the project and publish artifacts to Maven Central
69+
- name: Build and publish
70+
env:
71+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
72+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
73+
OSS_SIGNING_KEY_ID: ${{ secrets.OSS_SIGNING_KEY_ID }}
74+
OSS_SIGNING_PASSWORD: ${{ secrets.OSS_SIGNING_PASSWORD }}
75+
OSS_SIGNING_KEY: ${{ secrets.OSS_SIGNING_KEY }}
76+
OSS_STAGING_PROFILE_ID: ${{ secrets.OSS_STAGING_PROFILE_ID }}
77+
POM_DEVELOPER_ID: ${{ secrets.POM_DEVELOPER_ID }}
78+
POM_DEVELOPER_NAME: ${{ secrets.POM_DEVELOPER_NAME }}
79+
POM_DEVELOPER_EMAIL: ${{ secrets.POM_DEVELOPER_EMAIL }}
80+
run: ./gradlew publishAllPublicationsToSonatypeRepository --stacktrace

publish-package.gradle

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apply plugin: 'maven-publish'
22
apply plugin: 'signing'
33

4+
45
task androidJavadoc(type: Javadoc) {
56
source = android.sourceSets.main.java.srcDirs
67
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
@@ -48,8 +49,8 @@ afterEvaluate {
4849
artifactId 'sirenapp-android-inbox'
4950
version '1.0.0'
5051
pom {
51-
name = artifactId
52-
description = POM_DESCRIPTION
52+
name = "$System.env.ARTIFACT_ID"
53+
description = "$System.env.POM_DESCRIPTION"
5354
url = 'https://github.com/KeyValueSoftwareSystems/siren-android-inbox'
5455
licenses {
5556
license {
@@ -63,9 +64,9 @@ afterEvaluate {
6364
}
6465
developers {
6566
developer {
66-
id = POM_DEVELOPER_ID
67-
name = POM_DEVELOPER_NAME
68-
email = POM_DEVELOPER_EMAIL
67+
id = "$System.env.POM_DEVELOPER_ID"
68+
name = "$System.env.POM_DEVELOPER_NAME"
69+
email = "$System.env.POM_DEVELOPER_EMAIL"
6970
}
7071
}
7172
}
@@ -78,8 +79,8 @@ afterEvaluate {
7879
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
7980

8081
credentials {
81-
username ossrhUsername
82-
password ossrhPassword
82+
username "$System.env.OSSRH_USERNAME"
83+
password "$System.env.OSSRH_PASSWORD"
8384
}
8485
}
8586

@@ -89,14 +90,15 @@ afterEvaluate {
8990
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
9091

9192
credentials {
92-
username ossrhUsername
93-
password ossrhPassword
93+
username "$System.env.OSSRH_USERNAME"
94+
password "$System.env.OSSRH_PASSWORD"
9495
}
9596
}
9697
}
9798
}
9899
}
99100

101+
100102
signing {
101103
sign publishing.publications
102-
}
104+
}

0 commit comments

Comments
 (0)