Skip to content

Commit

Permalink
fix: mvn repository publish logic
Browse files Browse the repository at this point in the history
  • Loading branch information
h-beeen committed Nov 13, 2024
1 parent f5c130d commit 95d10ac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
name: Publish to Maven Central Repository
name: publish to mvn Repository

on:
workflow_run:
workflows: ["Verify"]
workflows: ["verify"]
branches: [master]
types:
- completed

jobs:
publish:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/master' }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

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

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Extract version from build.gradle.kts
id: get_version
run: echo "::set-output name=VERSION::$(./gradlew -q printVersion)"
run: echo "VERSION=$(./gradlew -q printVersion)" >> $GITHUB_OUTPUT

- name: Create Git tag
env:
Expand All @@ -41,7 +50,7 @@ jobs:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Configure gradle-wrapper.properties
- name: Configure gradle.properties
run: |
echo "mavenCentralUsername=${{ secrets.OSSRH_USERNAME }}" >> gradle.properties
echo "mavenCentralPassword=${{ secrets.OSSRH_PASSWORD }}" >> gradle.properties
Expand All @@ -54,4 +63,4 @@ jobs:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
./gradlew publishAllPublicationsToMavenCentralRepository --stacktrace --debug
./gradlew publishAllPublicationsToMavenCentralRepository --stacktrace --debug
10 changes: 6 additions & 4 deletions .github/workflows/build.yml → .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Build Verification
name: verify

on:
push:
branches:
- '*'

jobs:
build:
Expand All @@ -12,10 +14,10 @@ jobs:

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

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
Expand All @@ -24,4 +26,4 @@ jobs:
run: chmod +x gradlew

- name: Build with JDK ${{ matrix.java-version }}
run: ./gradlew build
run: ./gradlew build

0 comments on commit 95d10ac

Please sign in to comment.