Skip to content

Commit 91ed38b

Browse files
committed
Extract spring-artifactory-gradle-build.yml WF
This would be good reusable workflow in both SNAPSHOT and Staging build phases. Having only a single reusable workflow makes it easy to digest and support this project. * Leave `spring-artifactory-gradle-snapshot.yml` as top-level WF since it might be used externally. * Rename `spring-artifactory-gradle-release-stage.yml` to the `spring-artifactory-gradle-build.yml` and use generic description and input names fiting to both staging and snapshot variants of use. * Use new `spring-artifactory-gradle-build.yml` in the `spring-artifactory-gradle-release.yml`
1 parent 8633247 commit 91ed38b

File tree

3 files changed

+26
-45
lines changed

3 files changed

+26
-45
lines changed

.github/workflows/spring-artifactory-gradle-release-staging.yml renamed to .github/workflows/spring-artifactory-gradle-build.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
name: Build with Gradle and Stage Release to Artifactory
1+
name: CI Artifactory Build for Gradle
22

33
on:
44
workflow_call:
55
inputs:
66
releaseVersion:
7-
description: 'Release version like 3.0.0-M1, 3.1.0-RC1, 3.2.0 etc.'
8-
required: true
7+
description: 'Release version like 3.0.0-M1, 3.1.0-RC1, 3.2.0 etc. If not specified this workflow acts as a SNAPSHOT build.'
8+
required: false
99
type: string
1010
gradleTasks:
11-
description: 'Additional Gradle tasks. The `build` and `artifactoryPublish` are included.'
11+
description: 'Additional Gradle tasks. The `build` and `publishAllPublicationsToDeploymentRepository` are included.'
1212
required: false
1313
type: string
1414
artifactoryUrl:
1515
description: 'The Artifactory Server'
1616
required: false
1717
type: string
18-
stagingRepository:
19-
description: 'The Artifactory Repository to stage artifacts to'
18+
targetRepository:
19+
description: 'The Artifactory Repository to upload artifacts to'
2020
required: false
2121
type: string
22-
default: libs-staging-local
2322
artifactoryProjectKey:
2423
description: 'The Artifactory project key'
2524
required: false
@@ -33,20 +32,18 @@ on:
3332
outputs:
3433
buildName:
3534
description: 'Artifactory Build Name'
36-
value: ${{ jobs.staging-to-artifactory-with-gradle.outputs.buildName }}
35+
value: ${{ jobs.build-with-gradle.outputs.buildName }}
3736
buildNumber:
3837
description: 'Artifactory Build Number'
39-
value: ${{ jobs.staging-to-artifactory-with-gradle.outputs.buildNumber }}
38+
value: ${{ jobs.build-with-gradle.outputs.buildNumber }}
4039

4140
secrets:
42-
GH_ACTIONS_REPO_TOKEN:
43-
required: true
41+
DEVELOCITY_ACCESS_KEY:
42+
required: false
4443
ARTIFACTORY_USERNAME:
4544
required: true
4645
ARTIFACTORY_PASSWORD:
4746
required: true
48-
DEVELOCITY_ACCESS_KEY:
49-
required: false
5047
GPG_PASSPHRASE:
5148
required: false
5249
GPG_PRIVATE_KEY:
@@ -57,8 +54,10 @@ env:
5754
WORKFLOWS_REF: main
5855

5956
jobs:
60-
staging-to-artifactory-with-gradle:
57+
build-with-gradle:
6158
runs-on: ${{ inputs.runner }}
59+
name: CI Build for ${{ github.ref_name }}
60+
6261
outputs:
6362
buildName: ${{ steps.build-and-publish.outputs.buildName }}
6463
buildNumber: ${{ steps.build-and-publish.outputs.buildNumber }}
@@ -85,9 +84,11 @@ jobs:
8584
releaseVersion: ${{ inputs.releaseVersion }}
8685
gradleTasks: ${{ inputs.gradleTasks }}
8786
artifactoryUrl: ${{ inputs.artifactoryUrl }}
88-
targetRepository: ${{ inputs.stagingRepository }}
87+
targetRepository: ${{ inputs.targetRepository }}
8988
artifactoryProjectKey: ${{ inputs.artifactoryProjectKey }}
9089
artifactoryUsername: ${{ secrets.ARTIFACTORY_USERNAME }}
9190
artifactoryPassword: ${{ secrets.ARTIFACTORY_PASSWORD }}
9291
gpgPrivateKey: ${{ secrets.GPG_PRIVATE_KEY }}
9392
gpgPassphrase: ${{ secrets.GPG_PASSPHRASE }}
93+
94+

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ jobs:
8181
staging:
8282
needs: releaseVersion
8383
name: Stage ${{ needs.releaseVersion.outputs.releaseVersion }}
84-
uses: ./.github/workflows/spring-artifactory-gradle-release-staging.yml
84+
uses: ./.github/workflows/spring-artifactory-gradle-build.yml
8585
with:
8686
releaseVersion: ${{ needs.releaseVersion.outputs.releaseVersion }}
8787
gradleTasks: ${{ inputs.buildToolArgs }}
8888
artifactoryUrl: ${{ inputs.artifactoryUrl }}
89-
stagingRepository: ${{ inputs.stagingRepository }}
89+
targetRepository: ${{ inputs.stagingRepository }}
9090
artifactoryProjectKey: ${{ inputs.artifactoryProjectKey }}
9191
runner: ${{ inputs.runner }}
9292
secrets: inherit

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

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,13 @@ env:
4343

4444
jobs:
4545
build-snapshot-with-gradle:
46-
runs-on: ${{ inputs.runner }}
4746
name: CI Build SNAPSHOT for ${{ github.ref_name }}
48-
steps:
49-
50-
- uses: actions/checkout@v4
51-
with:
52-
show-progress: false
53-
54-
- name: Checkout Common Repo
55-
uses: actions/checkout@v4
56-
with:
57-
repository: spring-io/spring-github-workflows
58-
path: spring-github-workflows
59-
show-progress: false
60-
ref: ${{ env.WORKFLOWS_REF }}
61-
62-
- name: Build and Publish
63-
timeout-minutes: 30
64-
uses: ./spring-github-workflows/.github/actions/spring-artifactory-gradle-build
65-
with:
66-
gradleTasks: ${{ inputs.gradleTasks }}
67-
artifactoryUrl: ${{ inputs.artifactoryUrl }}
68-
targetRepository: ${{ inputs.targetRepository }}
69-
artifactoryProjectKey: ${{ inputs.artifactoryProjectKey }}
70-
artifactoryUsername: ${{ secrets.ARTIFACTORY_USERNAME }}
71-
artifactoryPassword: ${{ secrets.ARTIFACTORY_PASSWORD }}
72-
gpgPrivateKey: ${{ secrets.GPG_PRIVATE_KEY }}
73-
gpgPassphrase: ${{ secrets.GPG_PASSPHRASE }}
74-
47+
uses: ./.github/workflows/spring-artifactory-gradle-build.yml
48+
with:
49+
gradleTasks: ${{ inputs.gradleTasks }}
50+
artifactoryUrl: ${{ inputs.artifactoryUrl }}
51+
targetRepository: ${{ inputs.targetRepository }}
52+
artifactoryProjectKey: ${{ inputs.artifactoryProjectKey }}
53+
runner: ${{ inputs.runner }}
54+
secrets: inherit
7555

0 commit comments

Comments
 (0)