Skip to content

Commit

Permalink
Add github support to publish
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Jul 30, 2024
1 parent 36bbe18 commit c14a26b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 20 deletions.
52 changes: 40 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is a basic workflow to help you get started with Actions
# This file was contributed by Carlos Parada and Yamel Senih from ERP Consultores y Asociados, C.A
# This file was contributed by Carlos Parada, Edwin Betancourt and Yamel Senih from ERP Consultores y Asociados, C.A

name: Publish With gradle to maven central

Expand All @@ -13,29 +13,57 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

build-ci:
name: Publish Project
publish-sonatype:
name: Publish Project (Sonatype)
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Java JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-package: 'jdk'
java-version: 11
architecture: x64

- name: Build with Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-version: 8.0.1
gradle-version: 8.0.2
arguments: publish
env:
ADEMPIERE_LIBRARY_VERSION: ${{ github.event.release.tag_name }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_TOKEN }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_deployVersion: ${{ github.event.release.tag_name }}
ORG_GRADLE_PROJECT_deployPublishUrl: ${{ secrets.DEPLOY_PUBLISH_SONATYPE_URL }}
ORG_GRADLE_PROJECT_deploySigningKey: ${{ secrets.PGP_SECRET }}
ORG_GRADLE_PROJECT_deploySigningPassword: ${{ secrets.PGP_PASSPHRASE }}
ORG_GRADLE_PROJECT_deployUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_deployPassword: ${{ secrets.OSSRH_TOKEN }}
publish-github:
name: Publish Project (Github)
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up Java JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-package: 'jdk'
java-version: 11
architecture: x64

- name: Build with Gradle
uses: gradle/gradle-build-action@v3
with:
gradle-version: 8.0.2
arguments: publish
env:
ORG_GRADLE_PROJECT_deployVersion: ${{ github.event.release.tag_name }}
ORG_GRADLE_PROJECT_deployPublishUrl: ${{ secrets.DEPLOY_PUBLISH_GITHUB_URL }}
ORG_GRADLE_PROJECT_deploySigningKey: ${{ secrets.PGP_SECRET }}
ORG_GRADLE_PROJECT_deploySigningPassword: ${{ secrets.PGP_PASSPHRASE }}
ORG_GRADLE_PROJECT_deployUsername: "${{ github.actor }}"
ORG_GRADLE_PROJECT_deployPassword: "${{ secrets.DEPLOY_TOKEN }}"
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ java {
}


def entityType = 'D'
def entityType = 'ECA32'
group = "io.github.adempiere"
version = System.getenv("ADEMPIERE_LIBRARY_VERSION") ?: "local-1.0.0"
version = findProperty("deployVersion") ?: "local-1.0.0"

jar {
manifest {
attributes(
"Implementation-Title": "ADempiere Template Management",
"Implementation-Title": "ADempiere S3 Connector",
"Implementation-Version": version,
"EntityType": entityType
)
Expand All @@ -64,10 +64,10 @@ publishing {
mavenLocal()

maven {
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
url = findProperty("deployPublishUrl") ?: System.properties['deploy.publish_url']
credentials {
username = findProperty("sonatypeUsername")
password = findProperty("sonatypePassword")
username = findProperty("deployUsername") ?: System.properties['deploy.user']
password = findProperty("deployPassword") ?: System.properties['deploy.token']
}
}
}
Expand Down Expand Up @@ -122,8 +122,8 @@ signing {
it.equals(PublishToMavenRepository)
}
}
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
def signingKey = findProperty("deploySigningKey")
def signingPassword = findProperty("deploySigningPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}

0 comments on commit c14a26b

Please sign in to comment.