Skip to content

Group build, test and asses in one workflow #3

Group build, test and asses in one workflow

Group build, test and asses in one workflow #3

name: Java Gradle library
# Reusable workflow for building and publishing Java Gradle libraries
on:
workflow_call:
inputs:
java-distribution:
description: "Java distribution to be installed. (Default is microsoft)"
required: false
type: string
default: "microsoft"
java-version:
description: "Java version to be installed. (Default is 11)"
required: false
type: string
default: "11"
gradle-version:
description: "Gradle version to be installed. (Default is wrapper)"
required: false
type: string
default: "wrapper"
gradle-cache:
description: "Whether Gradle caching is enabled or not. (Default is true)"
required: false
type: boolean
default: true
working-directory:
description: "Working directory of your Gradle artifacts. (Default is .)"
required: false
type: string
default: "."
secrets:
sonar-token:
description: "Token for Sonarcloud."
required: true
sonar-organization:
description: "Organization for Sonarcloud"
required: true
signing-secret-key-ring:
description: "Key ring (base64 encoded) for signing the Sonatype publication."
required: true
signing-key-id:
description: "Key id for signing the Sonatype publication."
required: true
signing-password:
description: "Password for signing the Sonatype publication."
required: true
ossrh-username:
description: "Username for signing into Sonatype repository."
required: true
ossrh-password:
description: "Password for signing into Sonatype repository."
required: true
github-username:
description: "GitHub username for requesting changes from API."
required: true
github-token:
description: "GitHub token for requesting changes from API."
required: true
jobs:
java-gradle-base:
name: Build, Test and Assess code quality
runs-on: ubuntu-22.04
steps:
- name: Build, Test & Assess
uses: bakdata/ci-templates/.github/workflows/java-gradle-base.yaml@feat/split-test
# uses: bakdata/ci-templates/.github/workflows/[email protected]
with:
java-distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
gradle-version: ${{ inputs.gradle-version }}
gradle-cache: ${{ inputs.gradle-cache }}
working-directory: ${{ inputs.working-directory }}
signing-key-id: ${{ secrets.signing-key-id }}
signing-password: ${{ secrets.signing-password }}
signing-secret-key-ring: ${{ secrets.signing-secret-key-ring }}
sonar-organization: ${{ secrets.sonar-organization }}
sonar-token: ${{ secrets.sonar-token }}
publish:
name: Publish
runs-on: ubuntu-22.04
needs: java-gradle-base
steps:
- name: Publish
uses: bakdata/ci-templates/actions/[email protected]
with:
signing-secret-key-ring: ${{ secrets.signing-secret-key-ring }}
signing-key-id: ${{ secrets.signing-key-id }}
signing-password: ${{ secrets.signing-password }}
ossrh-username: ${{ secrets.ossrh-username }}
ossrh-password: ${{ secrets.ossrh-password }}
java-distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
gradle-version: ${{ inputs.gradle-version }}
gradle-cache: ${{ inputs.gradle-cache }}
working-directory: ${{ inputs.working-directory }}
release:
name: Create Github release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
needs: publish
steps:
- name: Release on Github
uses: bakdata/ci-templates/actions/[email protected]
with:
github-username: ${{ secrets.github-username }}
github-token: ${{ secrets.github-token }}
java-distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
gradle-version: ${{ inputs.gradle-version }}
gradle-cache: ${{ inputs.gradle-cache }}
working-directory: ${{ inputs.working-directory }}