Skip to content

Commit

Permalink
👷 Add CI for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceglb committed Apr 9, 2024
1 parent c4c19a7 commit a4620c3
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/publish-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish Snapshot

on:
push:
branches:
- main
workflow_dispatch:

jobs:
check-version:
runs-on: ubuntu-latest
outputs:
is_snapshot: ${{ steps.check_snapshot.outputs.is_snapshot }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check for SNAPSHOT suffix
id: check_snapshot
run: |
VERSION_NAME=$(grep "^VERSION_NAME=" gradle.properties | cut -d '=' -f 2)
if [[ $VERSION_NAME == *-SNAPSHOT ]]; then
echo "::set-output name=is_snapshot::true"
else
echo "::set-output name=is_snapshot::false"
fi
publish:
name: Publish to Snapshot
runs-on: ubuntu-latest
needs: check-version
if: ${{ needs.check-version.outputs.is_snapshot == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Upload Artifacts
run: ./gradlew publishAllPublicationsToMavenCentralRepository
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
30 changes: 30 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish

on:
workflow_dispatch:

jobs:
publish:
name: Publish to Sonatype
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Upload Artifacts
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_IN_MEMORY_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }}

0 comments on commit a4620c3

Please sign in to comment.