Extract reusable GHA workflows
This commit is contained in:
2
.github/release-files-spec.json
vendored
2
.github/release-files-spec.json
vendored
@@ -7,7 +7,7 @@
|
||||
{
|
||||
"@build.name": "${buildname}",
|
||||
"@build.number": "${buildnumber}",
|
||||
"path": {"$match": "org*"}
|
||||
"path": {"$match": "org.springframework*"}
|
||||
},
|
||||
{
|
||||
"$or": [
|
||||
|
||||
44
.github/workflows/ci-snapshot.yml
vendored
44
.github/workflows/ci-snapshot.yml
vendored
@@ -2,51 +2,11 @@ name: CI SNAPSHOT
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
|
||||
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
|
||||
|
||||
jobs:
|
||||
build_snapshot:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'spring-projects'
|
||||
name: CI Build SNAPSHOT for ${{ github.ref_name }}
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
|
||||
|
||||
- name: Set up Gradle
|
||||
uses: spring-io/spring-gradle-build-action@v2
|
||||
|
||||
- uses: jfrog/setup-jfrog-cli@v3
|
||||
with:
|
||||
version: 2.50.2
|
||||
env:
|
||||
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
|
||||
|
||||
- name: Configure JFrog Cli
|
||||
run: |
|
||||
jf gradlec \
|
||||
--use-wrapper \
|
||||
--uses-plugin \
|
||||
--deploy-ivy-desc=false \
|
||||
--server-id-resolve repo.spring.io \
|
||||
--server-id-deploy repo.spring.io \
|
||||
--repo-resolve snapshot \
|
||||
--repo-deploy libs-snapshot-local
|
||||
echo JFROG_CLI_BUILD_NAME=${{ github.event.repository.name }}-${{ github.ref_name }} >> $GITHUB_ENV
|
||||
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
|
||||
|
||||
- name: Build and Publish
|
||||
run: |
|
||||
jf gradle build dist artifactoryPublish
|
||||
jf rt build-publish
|
||||
|
||||
uses: .github/workflows/spring-artifactory-gradle-snapshot.yml
|
||||
secrets: inherit
|
||||
33
.github/workflows/pr-build.yml
vendored
33
.github/workflows/pr-build.yml
vendored
@@ -2,36 +2,9 @@ name: Pull Request Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: adopt
|
||||
java-version: 17
|
||||
cache: gradle
|
||||
|
||||
- name: Run Gradle
|
||||
uses: burrunan/gradle-cache-action@v1
|
||||
with:
|
||||
debug: false
|
||||
concurrent: true
|
||||
gradle-build-scan-report: false
|
||||
arguments: check
|
||||
|
||||
- name: Capture Test Results
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-results
|
||||
path: '*/build/reports/tests/**/*.*'
|
||||
retention-days: 3
|
||||
uses: .github/workflows/spring-gradle-pull-request-build.yml
|
||||
|
||||
47
.github/workflows/promote-ga-to-central.yml
vendored
47
.github/workflows/promote-ga-to-central.yml
vendored
@@ -12,45 +12,8 @@ on:
|
||||
|
||||
jobs:
|
||||
release_to_central:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'spring-projects'
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
|
||||
|
||||
- uses: jfrog/setup-jfrog-cli@v3
|
||||
with:
|
||||
version: 2.50.2
|
||||
env:
|
||||
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
|
||||
|
||||
- name: Promote Build
|
||||
run: |
|
||||
jfrog rt build-promote ${{ inputs.buildName }} ${{ inputs.buildNumber }} libs-release-local
|
||||
|
||||
# Download released files
|
||||
- name: Download Release Files
|
||||
run: |
|
||||
jfrog rt download \
|
||||
--spec .github/release-files-spec.json \
|
||||
--spec-vars "buildname=${{ inputs.buildName }};buildnumber=${{ inputs.buildNumber }}"
|
||||
|
||||
# Create checksums, signatures and create staging repo on central and upload
|
||||
- uses: jvalkeal/nexus-sync@v0.0.2
|
||||
id: nexus
|
||||
with:
|
||||
url: ${{ secrets.OSSRH_URL }}
|
||||
username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
|
||||
password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
|
||||
staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }}
|
||||
create: true
|
||||
upload: true
|
||||
generate-checksums: true
|
||||
pgp-sign: true
|
||||
upload-parallel: 10
|
||||
pgp-sign-passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||
pgp-sign-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
close: true
|
||||
release: true
|
||||
uses: .github/workflows/spring-artifactory-promote-central.yml
|
||||
with:
|
||||
buildName: ${{ inputs.buildName }}
|
||||
buildNumber: ${{ inputs.buildNumber }}
|
||||
secrets: inherit
|
||||
20
.github/workflows/promote-milestone.yml
vendored
20
.github/workflows/promote-milestone.yml
vendored
@@ -6,22 +6,16 @@ on:
|
||||
buildName:
|
||||
description: 'The Artifactory Build Name'
|
||||
required: true
|
||||
type: string
|
||||
buildNumber:
|
||||
description: 'The Artifactory Build'
|
||||
required: true
|
||||
type: number
|
||||
|
||||
jobs:
|
||||
promote_milestone:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'spring-projects'
|
||||
steps:
|
||||
|
||||
- uses: jfrog/setup-jfrog-cli@v3
|
||||
with:
|
||||
version: 2.50.2
|
||||
env:
|
||||
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
|
||||
|
||||
- name: Promote Build
|
||||
run: |
|
||||
jfrog rt build-promote ${{ inputs.buildName }} ${{ inputs.buildNumber }} libs-milestone-local
|
||||
uses: .github/workflows/spring-artifactory-promote-milestone.yml
|
||||
with:
|
||||
buildName: ${{ inputs.buildName }}
|
||||
buildNumber: ${{ inputs.buildNumber }}
|
||||
secrets: inherit
|
||||
66
.github/workflows/release-staging.yml
vendored
66
.github/workflows/release-staging.yml
vendored
@@ -10,66 +10,10 @@ on:
|
||||
description: 'Next development version like 3.1.1-SNAPSHOT'
|
||||
required: true
|
||||
|
||||
run-name: Release version ${{ inputs.releaseVersion }}
|
||||
|
||||
env:
|
||||
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
|
||||
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
|
||||
|
||||
jobs:
|
||||
staging:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'spring-projects'
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
|
||||
|
||||
- name: Set up Gradle
|
||||
uses: spring-io/spring-gradle-build-action@v2
|
||||
|
||||
- uses: jfrog/setup-jfrog-cli@v3
|
||||
with:
|
||||
version: 2.50.2
|
||||
env:
|
||||
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
|
||||
|
||||
- name: Configure JFrog Cli
|
||||
run: |
|
||||
jf gradlec \
|
||||
--use-wrapper \
|
||||
--uses-plugin \
|
||||
--deploy-ivy-desc=false \
|
||||
--server-id-resolve repo.spring.io \
|
||||
--server-id-deploy repo.spring.io \
|
||||
--repo-resolve ${{ (contains(inputs.releaseVersion, 'M') || contains(inputs.releaseVersion, 'RC')) && 'milestone' || 'release' }} \
|
||||
--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
|
||||
|
||||
- name: Set Release Version
|
||||
run: |
|
||||
sed -i "s/version=.*/version=${{ inputs.releaseVersion }}/" gradle.properties
|
||||
|
||||
- name: Build and Publish
|
||||
run: |
|
||||
jf gradle build dist artifactoryPublish
|
||||
jf rt build-publish
|
||||
|
||||
- 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
|
||||
sed -i "s/version=.*/version=${{ inputs.nextDevelopmentVersion }}/" gradle.properties
|
||||
git commit -a -m "[artifactory-release] Next development version"
|
||||
git push origin
|
||||
|
||||
- name: Print Build Info
|
||||
run: |
|
||||
echo "::notice ::Artifactory Build Name=$JFROG_CLI_BUILD_NAME"
|
||||
echo "::notice ::Artifactory Build Number=$JFROG_CLI_BUILD_NUMBER"
|
||||
uses: .github/workflows/spring-artifactory-gradle-release-staging.yml
|
||||
with:
|
||||
releaseVersion: ${{ inputs.releaseVersion }}
|
||||
nextDevelopmentVersion: ${{ inputs.nextDevelopmentVersion }}
|
||||
secrets: inherit
|
||||
82
.github/workflows/spring-artifactory-gradle-release-staging.yml
vendored
Normal file
82
.github/workflows/spring-artifactory-gradle-release-staging.yml
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
name: Build with Gradle 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
|
||||
nextDevelopmentVersion:
|
||||
description: 'Next development version like 3.1.1-SNAPSHOT'
|
||||
required: true
|
||||
type: string
|
||||
gradleTasks:
|
||||
description: 'Additional Gradle tasks. The `build` and `artifactoryPublish` are included.'
|
||||
required: false
|
||||
default: 'dist'
|
||||
type: string
|
||||
|
||||
run-name: Release version ${{ inputs.releaseVersion }}
|
||||
|
||||
env:
|
||||
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
|
||||
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
|
||||
|
||||
jobs:
|
||||
staging:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'spring-projects'
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
|
||||
|
||||
- name: Set up Gradle
|
||||
uses: spring-io/spring-gradle-build-action@v2
|
||||
|
||||
- uses: jfrog/setup-jfrog-cli@v3
|
||||
with:
|
||||
version: 2.50.4
|
||||
env:
|
||||
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
|
||||
|
||||
- name: Configure JFrog Cli
|
||||
run: |
|
||||
jf gradlec \
|
||||
--use-wrapper \
|
||||
--uses-plugin \
|
||||
--deploy-ivy-desc=false \
|
||||
--server-id-resolve repo.spring.io \
|
||||
--server-id-deploy repo.spring.io \
|
||||
--repo-resolve ${{ (contains(inputs.releaseVersion, 'M') || contains(inputs.releaseVersion, 'RC')) && 'milestone' || 'release' }} \
|
||||
--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
|
||||
|
||||
- name: Set Release Version
|
||||
run: |
|
||||
sed -i "s/version=.*/version=${{ inputs.releaseVersion }}/" gradle.properties
|
||||
|
||||
- name: Build and Publish
|
||||
run: |
|
||||
jf gradle build ${{ inputs.gradleTasks }} artifactoryPublish
|
||||
jf rt build-publish
|
||||
|
||||
- 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
|
||||
sed -i "s/version=.*/version=${{ inputs.nextDevelopmentVersion }}/" gradle.properties
|
||||
git commit -a -m "[artifactory-release] Next development version"
|
||||
git push origin
|
||||
|
||||
- name: Print Build Info
|
||||
run: |
|
||||
echo "::notice ::Artifactory Build Name=$JFROG_CLI_BUILD_NAME"
|
||||
echo "::notice ::Artifactory Build Number=$JFROG_CLI_BUILD_NUMBER"
|
||||
52
.github/workflows/spring-artifactory-gradle-snapshot.yml
vendored
Normal file
52
.github/workflows/spring-artifactory-gradle-snapshot.yml
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
name: CI Artifactory SNAPSHOT Build for Gradle
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
gradleTasks:
|
||||
description: 'Additional Gradle tasks. The `build` and `artifactoryPublish` are included.'
|
||||
required: false
|
||||
default: 'dist'
|
||||
type: string
|
||||
|
||||
env:
|
||||
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
|
||||
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
|
||||
|
||||
jobs:
|
||||
build_snapshot:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'spring-projects'
|
||||
name: CI Build SNAPSHOT for ${{ github.ref_name }}
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Gradle
|
||||
uses: spring-io/spring-gradle-build-action@v2
|
||||
|
||||
- uses: jfrog/setup-jfrog-cli@v3
|
||||
with:
|
||||
version: 2.50.4
|
||||
env:
|
||||
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
|
||||
|
||||
- name: Configure JFrog Cli
|
||||
run: |
|
||||
jf gradlec \
|
||||
--use-wrapper \
|
||||
--uses-plugin \
|
||||
--deploy-ivy-desc=false \
|
||||
--server-id-resolve repo.spring.io \
|
||||
--server-id-deploy repo.spring.io \
|
||||
--repo-resolve snapshot \
|
||||
--repo-deploy libs-snapshot-local
|
||||
echo JFROG_CLI_BUILD_NAME=${{ github.event.repository.name }}-${{ github.ref_name }} >> $GITHUB_ENV
|
||||
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
|
||||
|
||||
- name: Build and Publish
|
||||
run: |
|
||||
jf gradle build ${{ inputs.gradleTasks }} artifactoryPublish
|
||||
jf rt build-publish
|
||||
|
||||
56
.github/workflows/spring-artifactory-promote-central.yml
vendored
Normal file
56
.github/workflows/spring-artifactory-promote-central.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
name: Promote Staged GA release from Artifactory to Maven Central
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
buildName:
|
||||
description: 'The Artifactory Build Name'
|
||||
required: true
|
||||
type: string
|
||||
buildNumber:
|
||||
description: 'The Artifactory Build'
|
||||
required: true
|
||||
type: number
|
||||
|
||||
jobs:
|
||||
release_to_central:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'spring-projects'
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: jfrog/setup-jfrog-cli@v3
|
||||
with:
|
||||
version: 2.50.4
|
||||
env:
|
||||
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
|
||||
|
||||
- name: Promote Build
|
||||
run: |
|
||||
jfrog rt build-promote ${{ inputs.buildName }} ${{ inputs.buildNumber }} libs-release-local
|
||||
|
||||
# Download released files
|
||||
- name: Download Release Files
|
||||
run: |
|
||||
jfrog rt download \
|
||||
--spec .github/release-files-spec.json \
|
||||
--spec-vars "buildname=${{ inputs.buildName }};buildnumber=${{ inputs.buildNumber }}"
|
||||
|
||||
# Create checksums, signatures and create staging repo on central and upload
|
||||
- uses: jvalkeal/nexus-sync@v0.0.2
|
||||
id: nexus
|
||||
with:
|
||||
url: ${{ secrets.OSSRH_URL }}
|
||||
username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
|
||||
password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
|
||||
staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }}
|
||||
create: true
|
||||
upload: true
|
||||
generate-checksums: true
|
||||
pgp-sign: true
|
||||
upload-parallel: 10
|
||||
pgp-sign-passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||
pgp-sign-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
close: true
|
||||
release: true
|
||||
29
.github/workflows/spring-artifactory-promote-milestone.yml
vendored
Normal file
29
.github/workflows/spring-artifactory-promote-milestone.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
name: Promote Staged Milestone in Artifactory
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
buildName:
|
||||
description: 'The Artifactory Build Name'
|
||||
required: true
|
||||
type: string
|
||||
buildNumber:
|
||||
description: 'The Artifactory Build'
|
||||
required: true
|
||||
type: number
|
||||
|
||||
jobs:
|
||||
promote_milestone:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'spring-projects'
|
||||
steps:
|
||||
|
||||
- uses: jfrog/setup-jfrog-cli@v3
|
||||
with:
|
||||
version: 2.50.4
|
||||
env:
|
||||
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
|
||||
|
||||
- name: Promote Build
|
||||
run: |
|
||||
jfrog rt build-promote ${{ inputs.buildName }} ${{ inputs.buildNumber }} libs-milestone-local
|
||||
36
.github/workflows/spring-gradle-pull-request-build.yml
vendored
Normal file
36
.github/workflows/spring-gradle-pull-request-build.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Pull Request Build with Gradle
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: adopt
|
||||
java-version: 17
|
||||
cache: gradle
|
||||
|
||||
- name: Run Gradle
|
||||
uses: burrunan/gradle-cache-action@v1
|
||||
with:
|
||||
debug: false
|
||||
concurrent: true
|
||||
gradle-build-scan-report: false
|
||||
arguments: check
|
||||
|
||||
- name: Capture Test Results
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-results
|
||||
path: '*/build/reports/tests/**/*.*'
|
||||
retention-days: 3
|
||||
Reference in New Issue
Block a user