Publish Library #18
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
# Perform a Gradle `build` which includes `assemble`, `check`, `test` | |
# of the projects, and uploads the generated artifacts. | |
name: Publish Library | |
# Controls when the action will run. | |
on: | |
workflow_dispatch: | |
inputs: | |
versionName: | |
description: 'Version Name' | |
required: true | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
release: | |
# The type of runner that the job will run on | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: gradle | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest | |
- name: Publish Library | |
run: | | |
echo "Publishing library🚀" | |
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache | |
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 "$GITHUB_ACTOR" | |
git tag -a $TAG -m "Release $TAG" | |
git push origin $TAG | |
env: | |
TAG: v${{ 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: v${{ github.event.inputs.versionName }} | |
release_name: v${{ github.event.inputs.versionName }} | |
draft: true | |
prerelease: false |