.github/workflows/release-build.yml #19
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
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: The version to tag the release with, e.g., 1.2.0, 1.2.1-alpha.1 | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Cache Gradle Modules | |
uses: actions/cache@v1 | |
with: | |
path: ~/.gradle/caches | |
key: gradle-caches-${{ hashFiles('**/*.gradle.kts') }} | |
- name: Cache Gradle Wrapper | |
uses: actions/cache@v1 | |
with: | |
path: ~/.gradle/wrapper | |
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
- name: Build and test | |
run: ./gradlew build -Prelease.version=${{ github.event.inputs.version }} --stacktrace | |
env: | |
CI: true | |
- name: Build and publish to sonatype | |
run: ./gradlew final closeAndReleaseSonatypeStagingRepository -Prelease.version=${{ github.event.inputs.version }} --stacktrace | |
env: | |
CI: true | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} | |
GRGIT_USER: ${{ github.actor }} | |
GRGIT_PASS: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ github.event.inputs.version }} | |
release_name: Release v${{ github.event.inputs.version }} | |
draft: true | |
prerelease: false |