Publish Library #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Library | |
on: | |
workflow_dispatch: | |
inputs: | |
versionName: | |
description: 'Version Name (e.g. 1.0.3 or 1.0.3-SNAPSHOT)' | |
required: true | |
jobs: | |
publish_library: | |
name: Publish Library on Maven Central | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Grant Permission to Execute Gradle | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build | |
- name: Publish Library | |
run: | | |
echo "Publishing and Releasing library 🚀" | |
./gradlew publish | |
echo "Published and Released ✅" | |
env: | |
ORG_GRADLE_PROJECT_VERSION_NAME: ${{ github.event.inputs.versionName }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }} | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} | |
- name: Create and push tag | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "$GITHUB_ACTOR" | |
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: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.versionName }} | |
release_name: ${{ github.event.inputs.versionName }} | |
draft: true | |
prerelease: false |