Add Maven staging support
* Make staging jobs conditional on project type: Maven or Gradle
This commit is contained in:
@@ -66,9 +66,10 @@ jobs:
|
||||
--use-wrapper \
|
||||
--repo-deploy libs-staging-local
|
||||
|
||||
echo JFROG_CLI_BUILD_NAME=${{ github.event.repository.name }}-${{ inputs.releaseVersion }} >> $GITHUB_ENV
|
||||
buildName=${{ github.event.repository.name }}-${{ inputs.releaseVersion }}
|
||||
echo JFROG_CLI_BUILD_NAME=$buildName >> $GITHUB_ENV
|
||||
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
|
||||
echo buildName=$JFROG_CLI_BUILD_NAME >> $GITHUB_OUTPUT
|
||||
echo buildName=$buildName >> $GITHUB_OUTPUT
|
||||
echo buildNumber=$JFROG_CLI_BUILD_NUMBER >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set Release Version
|
||||
|
||||
92
.github/workflows/spring-artifactory-maven-release-staging.yml
vendored
Normal file
92
.github/workflows/spring-artifactory-maven-release-staging.yml
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
name: Build with Maven and Stage Release to Artifactory
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
releaseVersion:
|
||||
description: 'Release version like 3.0.0-M1, 3.1.0-RC1, 3.2.0 etc.'
|
||||
required: true
|
||||
type: string
|
||||
mavenArgs:
|
||||
description: 'Additional mvn command arguments: goals, plugins etc. The `install` is included.'
|
||||
required: false
|
||||
type: string
|
||||
|
||||
outputs:
|
||||
buildName:
|
||||
description: 'Artifactory Build Name'
|
||||
value: ${{ jobs.staging-to-artifactory-with-maven.outputs.buildName }}
|
||||
buildNumber:
|
||||
description: 'Artifactory Build Number'
|
||||
value: ${{ jobs.staging-to-artifactory-with-maven.outputs.buildNumber }}
|
||||
|
||||
jobs:
|
||||
staging-to-artifactory-with-maven:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
buildName: ${{ steps.configure-jfrog.outputs.buildName }}
|
||||
buildNumber: ${{ steps.configure-jfrog.outputs.buildNumber }}
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: adopt
|
||||
java-version: 17
|
||||
cache: 'maven'
|
||||
|
||||
- uses: jfrog/setup-jfrog-cli@v3
|
||||
with:
|
||||
version: 2.50.4
|
||||
env:
|
||||
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
|
||||
|
||||
- name: Configure JFrog Cli
|
||||
id: configure-jfrog
|
||||
run: |
|
||||
jf mvnc \
|
||||
--use-wrapper=true \
|
||||
--repo-resolve-releases=libs-milestone \
|
||||
--repo-resolve-snapshots=snapshot \
|
||||
--repo-deploy-releases=libs-staging-local \
|
||||
--repo-deploy-snapshots=libs-snapshot-local
|
||||
|
||||
buildName=${{ github.event.repository.name }}-${{ inputs.releaseVersion }}
|
||||
echo JFROG_CLI_BUILD_NAME=$buildName >> $GITHUB_ENV
|
||||
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
|
||||
echo buildName=$buildName >> $GITHUB_OUTPUT
|
||||
echo buildNumber=$JFROG_CLI_BUILD_NUMBER >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set Release Version
|
||||
run: |
|
||||
./mvnw versions:set -DnewVersion=${{ inputs.releaseVersion }} -DgenerateBackupPoms=false -DprocessAllModules=true -B -ntp
|
||||
|
||||
- name: Build and Publish
|
||||
run: |
|
||||
jf mvn install -B -ntp ${{ inputs.mavenArgs }}
|
||||
jf rt build-publish
|
||||
|
||||
- name: Capture Test Results
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-results
|
||||
path: '**/target/surefire-reports/**/*.*'
|
||||
retention-days: 3
|
||||
|
||||
- name: Tag Release and Next Development Version
|
||||
run: |
|
||||
git config --global user.name 'Spring Builds'
|
||||
git config --global user.email 'builds@springframework.org'
|
||||
git commit -a -m "[artifactory-release] Release version ${{ inputs.releaseVersion }}"
|
||||
git tag "v${{ inputs.releaseVersion }}"
|
||||
git push --tags origin
|
||||
./mvnw build-helper:parse-version versions:set \
|
||||
-DnewVersion='${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${{ (contains(inputs.releaseVersion, '-M') || contains(inputs.releaseVersion, '-RC')) && '${parsedVersion.incrementalVersion}' || '${parsedVersion.nextIncrementalVersion}' }}'-SNAPSHOT \
|
||||
-DgenerateBackupPoms=false -DprocessAllModules=true -B -ntp
|
||||
git commit -a -m "[artifactory-release] Next development version"
|
||||
git push origin
|
||||
@@ -16,7 +16,7 @@ run-name: Release version ${{ inputs.releaseVersion }}
|
||||
|
||||
jobs:
|
||||
staging:
|
||||
uses: ./.github/workflows/stage-release.yml
|
||||
uses: spring-projects/spring-integration-aws/.github/workflows/spring-stage-release.yml@main
|
||||
with:
|
||||
releaseVersion: ${{ inputs.releaseVersion }}
|
||||
secrets: inherit
|
||||
|
||||
76
.github/workflows/spring-stage-release.yml
vendored
Normal file
76
.github/workflows/spring-stage-release.yml
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
name: Stage Release with Gradle or Maven to Artifactory
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
releaseVersion:
|
||||
description: 'Release version like 3.0.0-M1, 3.1.0-RC1, 3.2.0 etc.'
|
||||
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:
|
||||
maven-or-gradle:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
isMaven: ${{ steps.is-maven.outputs.isMaven }}
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- name: Check if project is Maven-based
|
||||
id: is-maven
|
||||
run: |
|
||||
if test -f pom.xml
|
||||
then
|
||||
echo isMaven=true >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo isMaven=false >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
staging-with-gradle:
|
||||
needs: maven-or-gradle
|
||||
if: ${{ ! needs.maven-or-gradle.outputs.isMaven }}
|
||||
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-gradle-release-staging.yml@main
|
||||
with:
|
||||
releaseVersion: ${{ inputs.releaseVersion }}
|
||||
secrets: inherit
|
||||
|
||||
|
||||
staging-with-maven:
|
||||
needs: maven-or-gradle
|
||||
if: ${{ needs.maven-or-gradle.outputs.isMaven }}
|
||||
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-maven-release-staging.yml@main
|
||||
with:
|
||||
releaseVersion: ${{ inputs.releaseVersion }}
|
||||
secrets: inherit
|
||||
|
||||
build-info:
|
||||
needs: [staging-with-gradle, staging-with-maven]
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
buildName: ${{ steps.output-build-info.outputs.buildName }}
|
||||
buildNumber: ${{ steps.output-build-info.outputs.buildNumber }}
|
||||
|
||||
steps:
|
||||
- name: Output Build Info
|
||||
id: output-build-info
|
||||
run: |
|
||||
if [ ${{ needs.staging-with-gradle.outputs.buildName }} ]
|
||||
then
|
||||
echo buildName=${{ needs.staging-with-gradle.outputs.buildName }} >> $GITHUB_OUTPUT
|
||||
echo buildNumber=${{ needs.staging-with-gradle.outputs.buildNumber }} >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo buildName=${{ needs.staging-with-maven.outputs.buildName }} >> $GITHUB_OUTPUT
|
||||
echo buildNumber=${{ needs.staging-with-maven.outputs.buildNumber }} >> $GITHUB_OUTPUT
|
||||
fi
|
||||
24
.github/workflows/stage-release.yml
vendored
24
.github/workflows/stage-release.yml
vendored
@@ -1,24 +0,0 @@
|
||||
name: Stage Release with Gradle to Artifactory
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
releaseVersion:
|
||||
description: 'Release version like 3.0.0-M1, 3.1.0-RC1, 3.2.0 etc.'
|
||||
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
|
||||
with:
|
||||
releaseVersion: ${{ inputs.releaseVersion }}
|
||||
secrets: inherit
|
||||
@@ -1,3 +1,3 @@
|
||||
version=3.0.5-SNAPSHOT
|
||||
version=3.0.4-SNAPSHOT
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
||||
Reference in New Issue
Block a user