Skip to content

Commit

Permalink
Merge pull request #51 from Trendyol/AddPublishGithubAction
Browse files Browse the repository at this point in the history
Add a new workflow for publishing new versions
  • Loading branch information
MertNYuksel authored Aug 16, 2023
2 parents 5f2f1ab + 6b515fd commit 2fa5b89
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 21 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'

- name: Run unit tests
uses: gradle/[email protected]
with:
arguments: testDebugUnitTest

- name: Publish
uses: gradle/[email protected]
with:
arguments: publish
env:
SIGNING_KEY: ${{ secrets.SONARTYPE_GPG_PRIVATE_KEY }}
SIGNING_PASSWORD: ${{ secrets.SONARTYPE_GPG_PASSPHRASE }}
OSSRH_USERNAME: ${{ secrets.SONARTYPE_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.SONARTYPE_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
27 changes: 6 additions & 21 deletions scripts/publish-root.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.key"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
ext["sonatypeStagingProfileId"] = ''

File propertiesFile = project.rootProject.file('local.properties')

if (propertiesFile.exists()) {
Properties p = new Properties()
new FileInputStream(propertiesFile).withCloseable { is -> p.load(is) }
p.each { name, value -> ext[name] = value }
} else {
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
ext["signing.key"] = System.getenv('SIGNING_KEY')
}
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
ext["signing.key"] = System.getenv('SIGNING_KEY')
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')

nexusPublishing {
repositories {
Expand Down

0 comments on commit 2fa5b89

Please sign in to comment.