|
| 1 | +name: 'Build' |
| 2 | +description: 'Builds the project, optionally publishing it to a local deployment repository' |
| 3 | +inputs: |
| 4 | + java-version: |
| 5 | + required: false |
| 6 | + default: '17' |
| 7 | + description: 'The Java version to compile and test with' |
| 8 | + java-distribution: |
| 9 | + required: false |
| 10 | + default: 'liberica' |
| 11 | + description: 'The Java distribution to use for the build' |
| 12 | + java-toolchain: |
| 13 | + required: false |
| 14 | + default: 'false' |
| 15 | + description: 'Whether a Java toolchain should be used' |
| 16 | + publish: |
| 17 | + required: false |
| 18 | + default: 'false' |
| 19 | + description: 'Whether to publish artifacts ready for deployment to Artifactory' |
| 20 | + develocity-access-key: |
| 21 | + required: false |
| 22 | + description: 'The access key for authentication with ge.spring.io' |
| 23 | +outputs: |
| 24 | + build-scan-url: |
| 25 | + description: 'The URL, if any, of the build scan produced by the build' |
| 26 | + value: ${{ (inputs.publish == 'true' && steps.publish.outputs.build-scan-url) || steps.build.outputs.build-scan-url }} |
| 27 | + version: |
| 28 | + description: 'The version that was built' |
| 29 | + value: ${{ steps.read-version.outputs.version }} |
| 30 | +runs: |
| 31 | + using: composite |
| 32 | + steps: |
| 33 | + - name: Prepare Gradle Build |
| 34 | + uses: ./.github/actions/prepare-gradle-build |
| 35 | + with: |
| 36 | + develocity-access-key: ${{ inputs.develocity-access-key }} |
| 37 | + java-version: ${{ inputs.java-version }} |
| 38 | + java-distribution: ${{ inputs.java-distribution }} |
| 39 | + java-toolchain: ${{ inputs.java-toolchain }} |
| 40 | + - name: Build |
| 41 | + id: build |
| 42 | + if: ${{ inputs.publish == 'false' }} |
| 43 | + shell: bash |
| 44 | + run: ./gradlew build |
| 45 | + - name: Publish |
| 46 | + id: publish |
| 47 | + if: ${{ inputs.publish == 'true' }} |
| 48 | + shell: bash |
| 49 | + run: ./gradlew -PdeploymentRepository=$(pwd)/deployment-repository ${{ !startsWith(github.event.head_commit.message, 'Next development version') && 'build' || '' }} publishAllPublicationsToDeploymentRepository |
| 50 | + - name: Read Version From gradle.properties |
| 51 | + id: read-version |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + version=$(sed -n 's/version=\(.*\)/\1/p' gradle.properties) |
| 55 | + echo "Version is $version" |
| 56 | + echo "version=$version" >> $GITHUB_OUTPUT |
0 commit comments