Skip to content

Publish Library

Publish Library #4

name: Publish Library
permissions:
contents: write
on:
workflow_dispatch:
inputs:
versionName:
description: 'Version Name'
required: true
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
publish:
name: Publish
runs-on: macOS-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
- name: Grant Permission to Execute Gradle
run: chmod +x gradlew
- name: Setup gradle
uses: gradle/actions/setup-gradle@v3
- name: Build with Gradle
run: ./gradlew :KDeviceInfo:build --stacktrace
- name: Publish Library
run: |
echo "Publishing library🚀"
./gradlew publishAllPublicationsToMavenCentralRepository --no-configuration-cache
echo "Published✅"
# echo "Releasing repository...🚀"
# ./gradlew closeAndReleaseRepository
# echo "Released✅"
env:
ORG_GRADLE_PROJECT_VERSION_NAME: ${{ github.event.inputs.versionName }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
- name: Create and push tag
run: |
git config --global user.email "[email protected]"
git config --global user.name "Swapnil Musale"
git tag -a $TAG -m "Release v$TAG"
git push origin $TAG
env:
TAG: ${{ github.event.inputs.versionName }}