Skip to content

Commit cc6eaf1

Browse files
committed
Fix defaults for inputs as ternary operator
The GHA don't treat an empty input as fallback to default value, therefore we need to use something like `ARTIFACTORY_REPOSITORY: ${{ inputs.targetRepository == '' && 'libs-snapshot-local' || inputs.targetRepository }}` instead. * Fix milestone and central workflows to rely on the `secrets.JF_ARTIFACTORY_SPRING` instead of specific credentials * Propagate defaults from one reusable workflow to another since the previously mentioned treating for empty input
1 parent 8f248b2 commit cc6eaf1

6 files changed

+5
-20
lines changed

.github/actions/spring-artifactory-gradle-build/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ runs:
7575
echo "::notice title=Artifactory Build Name & Number::$ARTIFACTORY_BUILD_NAME/$ARTIFACTORY_BUILD_NUMBER"
7676
shell: bash
7777
env:
78-
ARTIFACTORY_URL: ${{ inputs.artifactoryUrl }}/artifactory
79-
ARTIFACTORY_REPOSITORY: ${{ inputs.targetRepository }}
78+
ARTIFACTORY_URL: ${{ inputs.artifactoryUrl == '' && 'https://repo.spring.io' || inputs.artifactoryUrl }}/artifactory
79+
ARTIFACTORY_REPOSITORY: ${{ inputs.targetRepository == '' && 'libs-snapshot-local' || inputs.targetRepository }}
8080
ARTIFACTORY_BUILD_PROJECT: ${{ inputs.artifactoryProjectKey }}
8181
ARTIFACTORY_BUILD_NAME: ${{ steps.build-name.outputs.buildName }}
8282
ARTIFACTORY_BUILD_NUMBER: ${{ github.run_number }}

.github/workflows/spring-artifactory-gradle-release-staging.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ on:
1515
description: 'The Artifactory Server'
1616
required: false
1717
type: string
18-
default: https://repo.spring.io
1918
stagingRepository:
2019
description: 'The Artifactory Repository to stage artifacts to'
2120
required: false

.github/workflows/spring-artifactory-gradle-release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@ on:
1515
description: 'The Artifactory Repository to stage artifacts to'
1616
required: false
1717
type: string
18+
default: libs-staging-local
1819
targetMilestoneRepository:
1920
description: 'The Artifactory Repository to promote the milestone build to'
2021
required: false
2122
type: string
23+
default: libs-milestone-local
2224
targetReleaseRepository:
2325
description: 'The Artifactory Repository to promote the release build to'
2426
required: false
2527
type: string
28+
default: libs-release-local
2629
artifactoryProjectKey:
2730
description: 'The Artifactory project key'
2831
required: false
@@ -115,7 +118,6 @@ jobs:
115118
if: ${{ !contains(needs.releaseVersion.outputs.releaseVersion, '-') }}
116119
uses: ./.github/workflows/spring-artifactory-promote-central.yml
117120
with:
118-
artifactoryUrl: ${{ inputs.artifactoryUrl }}
119121
buildName: ${{ needs.staging.outputs.buildName }}
120122
buildNumber: ${{ needs.staging.outputs.buildNumber }}
121123
targetRepository: ${{ inputs.targetReleaseRepository }}

.github/workflows/spring-artifactory-gradle-snapshot.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ on:
1111
description: 'The Artifactory Server'
1212
required: false
1313
type: string
14-
default: https://repo.spring.io
1514
targetRepository:
1615
description: 'The Artifactory Repository to upload snapshot artifacts to'
1716
required: false
1817
type: string
19-
default: libs-snapshot-local
2018
artifactoryProjectKey:
2119
description: 'The Artifactory project key'
2220
required: false

.github/workflows/spring-artifactory-promote-central.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ name: Promote Staged GA release from Artifactory to Maven Central
33
on:
44
workflow_call:
55
inputs:
6-
artifactoryUrl:
7-
description: 'The Artifactory Server'
8-
required: false
9-
type: string
10-
default: https://repo.spring.io
116
artifactoryProjectKey:
127
description: 'The Artifactory project key'
138
required: false

.github/workflows/spring-artifactory-promote-milestone.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ name: Promote Staged Milestone in Artifactory
33
on:
44
workflow_call:
55
inputs:
6-
artifactoryUrl:
7-
description: 'The Artifactory Server'
8-
required: false
9-
type: string
10-
default: https://repo.spring.io
116
artifactoryProjectKey:
127
description: 'The Artifactory project key'
138
required: false
@@ -40,10 +35,6 @@ jobs:
4035
steps:
4136

4237
- uses: jfrog/setup-jfrog-cli@v4
43-
env:
44-
JF_URL: ${{ inputs.artifactoryUrl }}
45-
JF_USER: ${{ secrets.ARTIFACTORY_USERNAME }}
46-
JF_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
4738

4839
- name: Promote Build
4940
run: jfrog rt build-promote ${{ inputs.buildName }} ${{ inputs.buildNumber }} ${{ inputs.targetRepository }} --project=${{ inputs.artifactoryProjectKey }}

0 commit comments

Comments
 (0)