Reusable workflows from a common repository

* Remove `release-files-spec.json` and `spring-project-init.gradle`
since they come from a common repository as well
This commit is contained in:
Artem Bilan
2023-11-16 12:32:43 -05:00
parent 4754d21d7f
commit 0ca38b0db9
14 changed files with 3 additions and 672 deletions

View File

@@ -8,5 +8,5 @@ on:
jobs:
build-snapshot:
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-gradle-snapshot.yml@main
uses: artembilan/spring-messaging-build-tools/spring-artifactory-gradle-snapshot.yml@main
secrets: inherit

View File

@@ -7,4 +7,4 @@ on:
jobs:
build-pull-request:
uses: spring-projects/spring-integration-aws/.github/workflows/spring-gradle-pull-request-build.yml@main
uses: artembilan/spring-messaging-build-tools/spring-gradle-pull-request-build.yml@main

View File

@@ -7,7 +7,7 @@ run-name: Release current version for branch ${{ github.ref_name }}
jobs:
release:
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-release.yml@main
uses: artembilan/spring-messaging-build-tools/spring-artifactory-release.yml@main
with:
buildToolArgs: dist
secrets: inherit

View File

@@ -1,91 +0,0 @@
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
gradleTasks:
description: 'Additional Gradle tasks. The `build` and `artifactoryPublish` are included.'
required: false
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 }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
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
with:
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
show-progress: false
- name: Set up Gradle
uses: spring-io/spring-gradle-build-action@v2
- name: Checkout Common Repo
uses: actions/checkout@v4
with:
repository: spring-projects/spring-integration-aws
path: build
show-progress: false
- name: Copy the spring-project-init.gradle
run: rsync build/.github/spring-project-init.gradle ~/.gradle/init.d/
- 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 gradlec \
--use-wrapper \
--repo-deploy libs-staging-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: sed -i "s/version=.*/version=${{ inputs.releaseVersion }}/" gradle.properties
- name: Build and Publish
run: |
jf gradle clean 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
jf gradle nextDevelopmentVersion
git commit -a -m "[artifactory-release] Next development version"
git push origin

View File

@@ -1,58 +0,0 @@
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-with-gradle:
runs-on: ubuntu-latest
name: CI Build SNAPSHOT for ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Set up Gradle
uses: spring-io/spring-gradle-build-action@v2
- name: Checkout Common Repo
uses: actions/checkout@v4
with:
repository: spring-projects/spring-integration-aws
path: build
show-progress: false
- name: Copy the spring-project-init.gradle
run: rsync build/.github/spring-project-init.gradle ~/.gradle/init.d/
- 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 \
--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 clean build ${{ inputs.gradleTasks }} artifactoryPublish
jf rt build-publish

View File

@@ -1,93 +0,0 @@
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 }}
show-progress: false
- 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

View File

@@ -1,57 +0,0 @@
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 Number'
required: true
type: string
jobs:
release-to-central:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: spring-projects/spring-integration-aws
show-progress: false
- 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

View File

@@ -1,27 +0,0 @@
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 Number'
required: true
type: string
jobs:
promote-milestone-with-jfrog:
runs-on: ubuntu-latest
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

View File

@@ -1,85 +0,0 @@
name: Perform Release with Artifactory
on:
workflow_call:
inputs:
buildToolArgs:
description: 'Additional Maven or Gradle command arguments: tasks, goals, plugins etc. The `install` for Maven is included. The `build` and `artifactoryPublish` for Gradle are included.'
required: false
type: string
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
jobs:
releaseVersion:
runs-on: ubuntu-latest
outputs:
releaseVersion: ${{ steps.release-version.outputs.releaseVersion }}
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Find Current Version to Release
id: release-version
run: |
if test -f pom.xml
then
CURRENT_VERSION=$(./mvnw help:evaluate -Dexpression="project.version" -q -DforceStdout)
else
CURRENT_VERSION=$(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')
fi
export CANDIDATE_VERSION=${CURRENT_VERSION/-SNAPSHOT}
RELEASE_VERSION=$(gh api repos/$GITHUB_REPOSITORY/milestones --jq 'map(select(.title | startswith(env.CANDIDATE_VERSION))) | .[0] | .title')
if [ -z $RELEASE_VERSION ]
then
gh run cancel ${{ github.run_id }}
echo "::warning title=Nothing to release::No scheduled milestone for $CURRENT_VERSION version"
else
echo releaseVersion=$RELEASE_VERSION >> $GITHUB_OUTPUT
echo "::notice title=RELEASE VERSION::$RELEASE_VERSION"
fi
staging:
needs: releaseVersion
uses: spring-projects/spring-integration-aws/.github/workflows/spring-stage-release.yml@main
with:
releaseVersion: ${{ needs.releaseVersion.outputs.releaseVersion }}
buildToolArgs: ${{ inputs.buildToolArgs }}
secrets: inherit
verify-staged:
needs: [releaseVersion, staging]
uses: ./.github/workflows/verify-staged-artifacts.yml
with:
releaseVersion: ${{ needs.releaseVersion.outputs.releaseVersion }}
secrets: inherit
promote-milestone:
needs: [releaseVersion, staging, verify-staged]
if: ${{ (contains(needs.releaseVersion.outputs.releaseVersion, '-M') || contains(needs.releaseVersion.outputs.releaseVersion, '-RC')) }}
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-promote-milestone.yml@main
with:
buildName: ${{ needs.staging.outputs.buildName }}
buildNumber: ${{ needs.staging.outputs.buildNumber }}
secrets: inherit
promote-ga:
needs: [releaseVersion, staging, verify-staged]
if: ${{ !contains(needs.releaseVersion.outputs.releaseVersion, '-') }}
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-promote-central.yml@main
with:
buildName: ${{ needs.staging.outputs.buildName }}
buildNumber: ${{ needs.staging.outputs.buildNumber }}
secrets: inherit
finalize:
if: ${{ !(failure() || cancelled()) }}
needs: [releaseVersion, promote-milestone, promote-ga]
uses: spring-projects/spring-integration-aws/.github/workflows/spring-finalize-release.yml@main
with:
milestone: ${{ needs.releaseVersion.outputs.releaseVersion }}
secrets: inherit

View File

@@ -1,58 +0,0 @@
name: Create GH release and Notify Slack
on:
workflow_call:
inputs:
milestone:
description: 'Milestone title, e.g 3.0.0-M1, 3.1.0-RC1, 3.2.0 etc.'
required: true
type: string
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
jobs:
finalize-releae:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Generate Changelog
run: |
repositoryTeam=$(gh api repos/$GITHUB_REPOSITORY/collaborators --jq 'map(select(.role_name == "admin") | .login) | tostring')
repositoryTeam=$(sed 's/"//g' <<< ${repositoryTeam:1:-1})
wget -q https://github.com/spring-io/github-changelog-generator/releases/download/v0.0.8/github-changelog-generator.jar
java -jar github-changelog-generator.jar $MILESTONE changelog.md \
--changelog.repository=$GITHUB_REPOSITORY \
--github.username=spring-builds \
--github.password=$GITHUB_TOKEN \
--changelog.contributors.exclude.names=$repositoryTeam
- name: GitHub Release
run: |
RELEASE_URL=$(gh release create v${{ env.MILESTONE }} -F changelog.md ${{ (contains(env.MILESTONE, '-M') || contains(env.MILESTONE, '-RC')) && '--prerelease' }})
echo "::notice title=Release Page::$RELEASE_URL"
- name: Close Milestone
run: |
MILESTONE_ID=$(gh api repos/$GITHUB_REPOSITORY/milestones --jq '.[] | select(.title == env.MILESTONE) | .number')
if [ $MILESTONE_ID ]; then
gh api -X PATCH repos/$GITHUB_REPOSITORY/milestones/$MILESTONE_ID -f state='closed' --silent
fi
# - name: Announce Release on Slack
# uses: slackapi/slack-github-action@v1.24.0
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_SLACK_WEBHOOK_URL }}
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
# with:
# payload: |
# {
# "text": "${{ github.event.repository.name }}-announcing `${{ env.MILESTONE }}`"
# }

View File

@@ -1,36 +0,0 @@
name: Pull Request Build with Gradle
on:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- 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

View File

@@ -1,86 +0,0 @@
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
buildToolArgs:
description: 'Additional Maven or Gradle command arguments: tasks, goals, plugins etc. The `install` for Maven is included. The `build` and `artifactoryPublish` for Gradle are included.'
required: false
type: string
outputs:
buildName:
description: 'Artifactory Build Name'
value: ${{ jobs.build-info.outputs.buildName }}
buildNumber:
description: 'Artifactory Build Number'
value: ${{ jobs.build-info.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 == 'false' }}
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-gradle-release-staging.yml@main
with:
releaseVersion: ${{ inputs.releaseVersion }}
gradleTasks: ${{ inputs.buildToolArgs }}
secrets: inherit
staging-with-maven:
needs: maven-or-gradle
if: ${{ needs.maven-or-gradle.outputs.isMaven == 'true' }}
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-maven-release-staging.yml@main
with:
releaseVersion: ${{ inputs.releaseVersion }}
mavenArgs: ${{ inputs.buildToolArgs }}
secrets: inherit
build-info:
needs: [staging-with-gradle, staging-with-maven]
if: ${{ !(failure() || cancelled()) }}
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
buildName=${{ needs.staging-with-gradle.outputs.buildName }}
buildNumber=${{ needs.staging-with-gradle.outputs.buildNumber }}
else
buildName=${{ needs.staging-with-maven.outputs.buildName }}
buildNumber=${{ needs.staging-with-maven.outputs.buildNumber }}
fi
echo buildName=$buildName >> $GITHUB_OUTPUT
echo buildNumber=$buildNumber >> $GITHUB_OUTPUT
echo "::notice title=Artifactory Build Name & Number::$buildName/$buildNumber"