Skip to content

Commit

Permalink
Use workflow outputs for build name & number
Browse files Browse the repository at this point in the history
  • Loading branch information
artembilan committed Nov 14, 2023
1 parent bfdf324 commit 5cbb08c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/spring-artifactory-gradle-release-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ on:
default: 'dist'
type: string

outputs:
buildName:
description: 'Artifactory Build Name'
value: ${{ jobs.staging-to-artifactory-with-gradle.outputs.buildName }}
buildNumber:
description: 'Artifactory Build Number'
value: ${{ jobs.staging-to-artifactory-with-gradle.outputs.buildNumber }}

env:
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
Expand All @@ -21,6 +29,10 @@ env:
jobs:
staging-to-artifactory-with-gradle:
runs-on: ubuntu-latest
outputs:
buildName: ${{ steps.configure-jfrog.outputs.buildName }}
buildNumber: ${{ steps.configure-jfrog.outputs.buildNumber }}

steps:

- uses: actions/checkout@v4
Expand Down Expand Up @@ -48,12 +60,14 @@ jobs:
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}

- name: Configure JFrog Cli
id: configure-jfrog
run: |
jf gradlec \
--use-wrapper \
--repo-deploy libs-staging-local
echo JFROG_CLI_BUILD_NAME=${{ github.event.repository.name }}-${{ inputs.releaseVersion }} >> $GITHUB_ENV
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
echo buildName=${{ github.event.repository.name }}-${{ inputs.releaseVersion }} >> $GITHUB_OUTPUT
echo buildNumber=$GITHUB_RUN_NUMBER >> $GITHUB_OUTPUT
- name: Set Release Version
run: sed -i "s/version=.*/version=${{ inputs.releaseVersion }}/" gradle.properties
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/spring-artifactory-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ jobs:

promote-milestone:
if: ${{ contains(inputs.releaseVersion, '-M') || contains(inputs.releaseVersion, '-RC') }}
needs: verify-staged
needs: [staging, verify-staged]
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-promote-milestone.yml@main
with:
buildName: ${{ env.JFROG_CLI_BUILD_NAME }}
buildNumber: ${{ env.JFROG_CLI_BUILD_NUMBER }}
buildName: ${{ needs.staging.outputs.buildName }}
buildNumber: ${{ needs.staging.outputs.buildNumber }}
secrets: inherit

promote-ga:
if: ${{ ! contains(inputs.releaseVersion, '-') }}
needs: verify-staged
needs: [staging, verify-staged]
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-promote-central.yml@main
with:
buildName: ${{ env.JFROG_CLI_BUILD_NAME }}
buildNumber: ${{ env.JFROG_CLI_BUILD_NUMBER }}
buildName: ${{ needs.staging.outputs.buildName }}
buildNumber: ${{ needs.staging.outputs.buildNumber }}
secrets: inherit

finalize:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/stage-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ on:
required: true
type: string

outputs:
buildName:
description: 'Artifactory Build Name'
value: ${{ jobs.staging-with-gradle.outputs.buildName }}
buildNumber:
description: 'Artifactory Build Number'
value: ${{ jobs.staging-with-gradle.outputs.buildNumber }}

jobs:
staging-with-gradle:
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-gradle-release-staging.yml@main
Expand Down

0 comments on commit 5cbb08c

Please sign in to comment.