spring-boot/.github/actions/build/action.yml
Andy Wilkinson 83f692237d Migrate to com.gradle.develocity plugin
Closes gh-40153
2024-04-26 09:30:48 +01:00

55 lines
1.9 KiB
YAML

name: 'Build'
description: 'Builds the project, optionally publishing it to a local deployment repository'
inputs:
java-version:
required: false
default: '17'
description: 'The Java version to compile and test with'
java-toolchain:
required: false
default: false
description: 'Whether a Java toolchain should be used'
publish:
required: false
default: false
description: 'Whether to publish artifacts ready for deployment to Artifactory'
develocity-access-key:
required: false
description: 'The access key for authentication with ge.spring.io'
outputs:
build-scan-url:
description: 'The URL, if any, of the build scan produced by the build'
value: ${{ (inputs.publish && steps.build-and-publish.outputs.build-scan-url) || steps.build.outputs.build-scan-url }}
version:
description: 'The version that was built'
value: ${{ steps.read-version.outputs.version }}
runs:
using: composite
steps:
- name: Prepare Gradle Build
uses: ./.github/actions/prepare-gradle-build
with:
java-version: ${{ inputs.java-version }}
java-toolchain: ${{ inputs.java-toolchain }}
- name: Build
id: build
if: ${{ !inputs.publish }}
shell: bash
env:
DEVELOCITY_ACCESS_KEY: ${{ inputs.develocity-access-key }}
run: ./gradlew build
- name: Build and Publish
id: build-and-publish
if: ${{ inputs.publish }}
shell: bash
env:
DEVELOCITY_ACCESS_KEY: ${{ inputs.develocity-access-key }}
run: ./gradlew -PdeploymentRepository=$(pwd)/deployment-repository build publishAllPublicationsToDeploymentRepository
- name: Read Version From gradle.properties
id: read-version
shell: bash
run: |
version=$(sed -n 's/version=\(.*\)/\1/p' gradle.properties)
echo "Version is $version"
echo "version=$version" >> $GITHUB_OUTPUT