Skip to content

Commit

Permalink
build: Add/workflow maven publish (#51)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people committed Jun 20, 2024
1 parent 2921a13 commit 1d5f7f3
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 10 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Publish to Maven Central

on:
workflow_dispatch:
# workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
# Step to check out the repository's code
- name: Checkout code
uses: actions/checkout@v3

# Step to set up JDK 17, which is required for Gradle to run
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'

- name: Find the location of jdk
run: echo "${{ env.JAVA_HOME }}"

# - name: List the contents of the path java
# run: cd /opt/hostedtoolcache/jdk/17.0.11/x64 | ls

- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0

# Step to grant execute permissions to the Gradle wrapper script
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Add new line
run: echo "" >> gradle.properties

- name: Add java home to gradle.properties
run: echo "org.gradle.java.home=${{ env.JAVA_HOME }}" >> gradle.properties

- name: Add signing key id to gradle.properties
run: echo "signing.keyId=${{ secrets.OSS_SIGNING_KEY_ID }}" >> gradle.properties

- name: Add signing password to gradle.proeprties
run: echo "signing.password=${{ secrets.OSS_SIGNING_PASSWORD }}" >> gradle.properties

- name: Add secret file loc to gradle.properties
run: echo "signing.secretKeyRingFile=/home/runner/work/siren-android-inbox/siren-android-inbox/siren-sdk/secring.gpg" >> gradle.properties

- name: Configure AWS credentials

uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE }}

- name: Download s3 secring file
run: aws s3 cp s3://${{ secrets.BUCKET }}/secring.gpg /home/runner/work/siren-android-inbox/siren-android-inbox/siren-sdk/secring.gpg

# - name: cat secring.gpg
# run: cat /home/runner/work/siren-android-inbox/siren-android-inbox/siren-sdk/secring.gpg

- name: Echo gradle.properties
run: cat gradle.properties
#Step to build the project and publish artifacts to Maven Central
- name: Build and publish
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSS_SIGNING_KEY_ID: ${{ secrets.OSS_SIGNING_KEY_ID }}
OSS_SIGNING_PASSWORD: ${{ secrets.OSS_SIGNING_PASSWORD }}
OSS_SIGNING_KEY: ${{ secrets.OSS_SIGNING_KEY }}
OSS_STAGING_PROFILE_ID: ${{ secrets.OSS_STAGING_PROFILE_ID }}
POM_DEVELOPER_ID: ${{ secrets.POM_DEVELOPER_ID }}
POM_DEVELOPER_NAME: ${{ secrets.POM_DEVELOPER_NAME }}
POM_DEVELOPER_EMAIL: ${{ secrets.POM_DEVELOPER_EMAIL }}
run: ./gradlew publishAllPublicationsToSonatypeRepository --stacktrace
22 changes: 12 additions & 10 deletions publish-package.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'


task androidJavadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
Expand Down Expand Up @@ -48,8 +49,8 @@ afterEvaluate {
artifactId 'sirenapp-android-inbox'
version '1.0.0'
pom {
name = artifactId
description = POM_DESCRIPTION
name = "$System.env.ARTIFACT_ID"
description = "$System.env.POM_DESCRIPTION"
url = 'https://github.com/KeyValueSoftwareSystems/siren-android-inbox'
licenses {
license {
Expand All @@ -63,9 +64,9 @@ afterEvaluate {
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
email = POM_DEVELOPER_EMAIL
id = "$System.env.POM_DEVELOPER_ID"
name = "$System.env.POM_DEVELOPER_NAME"
email = "$System.env.POM_DEVELOPER_EMAIL"
}
}
}
Expand All @@ -78,8 +79,8 @@ afterEvaluate {
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"

credentials {
username ossrhUsername
password ossrhPassword
username "$System.env.OSSRH_USERNAME"
password "$System.env.OSSRH_PASSWORD"
}
}

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

credentials {
username ossrhUsername
password ossrhPassword
username "$System.env.OSSRH_USERNAME"
password "$System.env.OSSRH_PASSWORD"
}
}
}
}
}


signing {
sign publishing.publications
}
}

0 comments on commit 1d5f7f3

Please sign in to comment.