Skip to content

Publish Library

Publish Library #2

name: Publish Library
permissions:
contents: write
on:
workflow_dispatch:
inputs:
versionName:
description: 'Version Name'
required: 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 createStagingRepository --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 "swapnilmusale19@gmail.com"
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 }}
- name: Create Release on GitHub
id: create_release
uses: ncipollo/release-action@v1
env:
token: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ github.event.inputs.versionName }}
name: V${{ github.event.inputs.versionName }}
generateReleaseNotes: true
draft: true
prerelease: false