Skip to content

Commit 0ba14c1

Browse files
committed
Add release train automation.
Closes spring-projects/spring-data-build#2891
1 parent c64558c commit 0ba14c1

13 files changed

Lines changed: 429 additions & 8 deletions
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build Release
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Write settings.xml
6+
if: ${{ env.RELEASE_TRAIN_SETTINGS_XML != '' }}
7+
shell: bash
8+
run: |
9+
echo "::notice::Writing provided settings-xml input to release-train-settings.xml"
10+
echo "${RELEASE_TRAIN_SETTINGS_XML}" > release-train-settings.xml
11+
- name: Prepare Maven command
12+
shell: bash
13+
run: |
14+
MAVEN_LOGGING_OPTS=()
15+
if [[ "${RUNNER_DEBUG}" == "1" || "${ACTIONS_STEP_DEBUG}" == "true" ]]; then
16+
echo "::notice::transfer-progress enabled"
17+
else
18+
MAVEN_LOGGING_OPTS+=(--no-transfer-progress)
19+
fi
20+
21+
echo "RELEASE_TRAIN_MVN=./mvnw --batch-mode ${MAVEN_LOGGING_OPTS[*]} --settings release-train-settings.xml clean deploy -DaltDeploymentRepository=release-train::file://$(pwd)/deployment-repository -DskipTests -Dgpg.skip" >> "${GITHUB_ENV}"
22+
- name: Build Release
23+
shell: bash
24+
run: ${RELEASE_TRAIN_MVN} --activate-profiles releaseTrain,release,ci
25+
- name: Distribution build
26+
shell: bash
27+
run: ${RELEASE_TRAIN_MVN} --activate-profiles releaseTrain,distribute
28+
- name: Schema build
29+
shell: bash
30+
run: ${RELEASE_TRAIN_MVN} --activate-profiles releaseTrain,distribute-schema
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
artifactory:
2+
artifacts:
3+
- pattern: "/**/spring-data-*-docs.zip"
4+
properties:
5+
zip.deployed: "false"
6+
zip.type: "docs"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Test Release
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Write settings.xml
6+
if: ${{ env.RELEASE_TRAIN_SETTINGS_XML != '' }}
7+
shell: bash
8+
run: |
9+
echo "::notice::Writing provided settings-xml input to release-train-settings.xml"
10+
echo "${RELEASE_TRAIN_SETTINGS_XML}" > release-train-settings.xml
11+
- name: Prepare Maven command
12+
shell: bash
13+
run: |
14+
MAVEN_LOGGING_OPTS=()
15+
if [[ "${RUNNER_DEBUG}" == "1" || "${ACTIONS_STEP_DEBUG}" == "true" ]]; then
16+
echo "::notice::transfer-progress enabled"
17+
else
18+
MAVEN_LOGGING_OPTS+=(--no-transfer-progress)
19+
fi
20+
21+
echo "RELEASE_TRAIN_MVN=./mvnw --batch-mode ${MAVEN_LOGGING_OPTS[*]} --settings release-train-settings.xml clean verify -Dgpg.skip" >> "${GITHUB_ENV}"
22+
- name: Build Release
23+
shell: bash
24+
run: ${RELEASE_TRAIN_MVN} --activate-profiles releaseTrain,release,ci
25+
- name: Distribution build
26+
shell: bash
27+
run: ${RELEASE_TRAIN_MVN} --activate-profiles releaseTrain,distribute
28+
- name: Schema build
29+
shell: bash
30+
run: ${RELEASE_TRAIN_MVN} --activate-profiles releaseTrain,distribute-schema

.github/workflow-generator.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
workflow:
2+
generator:
3+
project:
4+
java:
5+
versions:
6+
primary: 25
7+
workflows:
8+
release-train:
9+
join:
10+
watch: false
11+
leave:
12+
watch: false
13+
ready:
14+
watch: false
15+
build:
16+
env:
17+
COMMERCIAL_REPO_USERNAME: secrets.COMMERCIAL_ARTIFACTORY_USERNAME
18+
COMMERCIAL_REPO_PASSWORD: secrets.COMMERCIAL_ARTIFACTORY_PASSWORD
19+
COMMERCIAL_RELEASE_REPO_URL: vars.COMMERCIAL_RELEASE_REPO_URL
20+
RELEASE_TRAIN_SETTINGS_XML: vars.RELEASE_TRAIN_SETTINGS_XML
21+
test:
22+
env:
23+
COMMERCIAL_REPO_USERNAME: secrets.COMMERCIAL_ARTIFACTORY_USERNAME
24+
COMMERCIAL_REPO_PASSWORD: secrets.COMMERCIAL_ARTIFACTORY_PASSWORD
25+
COMMERCIAL_RELEASE_REPO_URL: vars.COMMERCIAL_RELEASE_REPO_URL
26+
RELEASE_TRAIN_SETTINGS_XML: vars.RELEASE_TRAIN_SETTINGS_XML

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
matrix:
1414
java-version: [ base, main ]
1515
name: Build project
16-
runs-on: ubuntu-latest
16+
runs-on: ${{ vars.ACTION_RUNNER || 'ubuntu-latest' }}
1717
steps:
1818
- uses: actions/checkout@v6
1919
- name: Setup Java and Maven
@@ -23,5 +23,10 @@ jobs:
2323
develocity-access-key: '${{ secrets.DEVELOCITY_ACCESS_KEY }}'
2424
- name: Build
2525
uses: spring-projects/spring-data-build/actions/maven-build@main
26+
env:
27+
OSS_ARTIFACTORY_USR: '${{ secrets.ARTIFACTORY_USERNAME }}'
28+
OSS_ARTIFACTORY_PSW: '${{ secrets.ARTIFACTORY_PASSWORD }}'
29+
COMMERCIAL_ARTIFACTORY_USR: '${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }}'
30+
COMMERCIAL_ARTIFACTORY_PSW: '${{ secrets.COMMERCIAL_ARTIFACTORY_PASSWORD }}'
2631
with:
2732
settings-xml: '${{ vars.SETTINGS_XML }}'

.github/workflows/codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ name: "CodeQL Advanced"
44

55
on:
66
push:
7+
branches: [ main ]
78
pull_request:
89
workflow_dispatch:
910
schedule:
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# This file was auto-generated by github-actions-workflow-generator 0.0.6. Do not edit.
2+
# To update it, modify .github/workflow-generator.yml as needed and re-run the generator.
3+
4+
name: "Release Train – Build"
5+
run-name: "${{ inputs.callback-ref }} – Build"
6+
"on":
7+
workflow_dispatch:
8+
inputs:
9+
callback:
10+
description: "Repository to which a callback should be made upon completion"
11+
required: true
12+
type: "string"
13+
callback-ref:
14+
description: "Ref in the callback repository to which a callback should be made upon completion"
15+
required: true
16+
type: "string"
17+
release-train-maven-repository-url:
18+
description: "URL of a Maven repository to be used to resolve artifacts of projects earlier in the train"
19+
required: true
20+
type: "string"
21+
permissions:
22+
contents: "read"
23+
concurrency:
24+
group: "${{ github.workflow }}-${{ github.ref }}"
25+
jobs:
26+
build-release:
27+
name: "Build Release"
28+
runs-on: "ubuntu22-2-8"
29+
steps:
30+
- name: "Prevent Re-runs"
31+
id: "prevent-re-runs"
32+
run: |-
33+
if [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then
34+
echo "Re-runs are prohibited. Use the 'Release Train – Retry' workflow to retry build failures"
35+
exit 1
36+
fi
37+
- name: "Set up Java"
38+
id: "set-up-java"
39+
uses: "actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95" # v5.6.0
40+
with:
41+
distribution: "liberica"
42+
java-version: "25"
43+
- name: "Check Out Code"
44+
id: "check-out-code"
45+
uses: "actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0" # v7.0.0
46+
- name: "Build Release"
47+
id: "build-release"
48+
uses: "./.github/actions/release-train-build"
49+
env:
50+
COMMERCIAL_RELEASE_REPO_URL: "${{ vars.COMMERCIAL_RELEASE_REPO_URL }}"
51+
COMMERCIAL_REPO_PASSWORD: "${{ secrets.COMMERCIAL_ARTIFACTORY_PASSWORD }}"
52+
COMMERCIAL_REPO_USERNAME: "${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }}"
53+
RELEASE_TRAIN_MAVEN_REPOSITORY_PASSWORD: "${{ secrets.RELEASE_TRAIN_PARTICIPANT_MAVEN_REPOSITORY_PASSWORD }}"
54+
RELEASE_TRAIN_MAVEN_REPOSITORY_URL: "${{ inputs.release-train-maven-repository-url }}"
55+
RELEASE_TRAIN_MAVEN_REPOSITORY_USERNAME: "${{ secrets.RELEASE_TRAIN_PARTICIPANT_MAVEN_REPOSITORY_USERNAME }}"
56+
RELEASE_TRAIN_SETTINGS_XML: "${{ vars.RELEASE_TRAIN_SETTINGS_XML }}"
57+
- name: "Upload Deployment Repository"
58+
id: "upload-deployment-repository"
59+
uses: "actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a" # v7.0.1
60+
with:
61+
name: "deployment-repository"
62+
path: "deployment-repository/**"
63+
- name: "Upload Deployment Spec"
64+
id: "upload-deployment-spec"
65+
uses: "actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a" # v7.0.1
66+
with:
67+
archive: "false"
68+
if-no-files-found: "ignore"
69+
name: "deployment-spec"
70+
path: ".github/actions/release-train-build/deployment-spec.yml"
71+
- name: "Save Build System Caches"
72+
id: "save-build-system-caches"
73+
uses: "actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9" # v6.1.0
74+
with:
75+
key: "release-train-${{ inputs.callback-ref }}-${{ github.ref_name }}"
76+
path: "~/.m2/repository"
77+
- name: "Send Callback"
78+
id: "send-callback"
79+
if: "${{ !cancelled() }}"
80+
env:
81+
GH_TOKEN: "${{ secrets.RELEASE_TRAIN_PARTICIPANT_GITHUB_TOKEN }}"
82+
run: |-
83+
gh workflow run callback \
84+
--repo ${{ inputs.callback }} \
85+
--ref ${{ inputs.callback-ref }} \
86+
--field commit-hash=${{ steps.check-out-code.outputs.commit }} \
87+
--field deployment-repository-artifact-identifier=${{ steps.upload-deployment-repository.outputs.artifact-id }} \
88+
--field deployment-spec-artifact-identifier=${{ steps.upload-deployment-spec.outputs.artifact-id }} \
89+
--field release-branch=${{ github.ref_name }} \
90+
--field release-repository=${{ github.repository }} \
91+
--field result=${{ job.status == 'success' && 'built' || 'build-failed' }} \
92+
--field workflow-run-url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This file was auto-generated by github-actions-workflow-generator 0.0.6. Do not edit.
2+
# To update it, modify .github/workflow-generator.yml as needed and re-run the generator.
3+
4+
name: "Release Train – Join"
5+
run-name: "${{ inputs.release-train }} – Join"
6+
"on":
7+
workflow_dispatch:
8+
inputs:
9+
deployment-destination:
10+
description: "Destination to which the release should be deployed"
11+
options:
12+
- "Maven Central"
13+
- "Spring Enterprise"
14+
required: true
15+
type: "choice"
16+
release-train:
17+
description: "Release train"
18+
required: true
19+
type: "string"
20+
release-train-repository:
21+
default: "spring-io/release-train"
22+
description: "Release train repository"
23+
required: true
24+
type: "string"
25+
permissions:
26+
contents: "none"
27+
jobs:
28+
join-release-train:
29+
name: "Join Release Train"
30+
runs-on: "ubuntu-latest"
31+
steps:
32+
- name: "Join Release Train"
33+
id: "join-release-train"
34+
env:
35+
GH_TOKEN: "${{ secrets.RELEASE_TRAIN_PARTICIPANT_GITHUB_TOKEN }}"
36+
run: |-
37+
gh workflow run join \
38+
--repo ${{ inputs.release-train-repository }} \
39+
--ref ${{ inputs.release-train }} \
40+
--field commit-hash=${{ github.sha }} \
41+
--field deployment-destination=${{ inputs.deployment-destination == 'Maven Central' && 'maven-central' || 'spring-enterprise' }} \
42+
--field release-branch=${{ github.ref_name }} \
43+
--field release-repository=${{ github.repository }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This file was auto-generated by github-actions-workflow-generator 0.0.6. Do not edit.
2+
# To update it, modify .github/workflow-generator.yml as needed and re-run the generator.
3+
4+
name: "Release Train – Leave"
5+
run-name: "${{ inputs.release-train }} – Leave"
6+
"on":
7+
workflow_dispatch:
8+
inputs:
9+
release-train:
10+
description: "Release train"
11+
required: true
12+
type: "string"
13+
release-train-repository:
14+
default: "spring-io/release-train"
15+
description: "Release train repository"
16+
required: true
17+
type: "string"
18+
permissions:
19+
contents: "none"
20+
jobs:
21+
leave:
22+
name: "Leave"
23+
runs-on: "ubuntu-latest"
24+
steps:
25+
- name: "Leave"
26+
id: "leave"
27+
env:
28+
GH_TOKEN: "${{ secrets.RELEASE_TRAIN_PARTICIPANT_GITHUB_TOKEN }}"
29+
run: |-
30+
gh workflow run leave \
31+
--repo ${{ inputs.release-train-repository }} \
32+
--ref ${{ inputs.release-train }} \
33+
--field release-branch=${{ github.ref_name }} \
34+
--field release-repository=${{ github.repository }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This file was auto-generated by github-actions-workflow-generator 0.0.6. Do not edit.
2+
# To update it, modify .github/workflow-generator.yml as needed and re-run the generator.
3+
4+
name: "Release Train – Ready"
5+
run-name: "${{ inputs.release-train }} – Ready"
6+
"on":
7+
workflow_dispatch:
8+
inputs:
9+
release-train:
10+
description: "Release train"
11+
required: true
12+
type: "string"
13+
release-train-repository:
14+
default: "spring-io/release-train"
15+
description: "Release train repository"
16+
required: true
17+
type: "string"
18+
permissions:
19+
contents: "none"
20+
jobs:
21+
ready:
22+
name: "Ready"
23+
runs-on: "ubuntu-latest"
24+
steps:
25+
- name: "Ready"
26+
id: "ready"
27+
env:
28+
GH_TOKEN: "${{ secrets.RELEASE_TRAIN_PARTICIPANT_GITHUB_TOKEN }}"
29+
run: |-
30+
gh workflow run ready \
31+
--repo ${{ inputs.release-train-repository }} \
32+
--ref ${{ inputs.release-train }} \
33+
--field commit-hash=${{ github.sha }} \
34+
--field release-branch=${{ github.ref_name }} \
35+
--field release-repository=${{ github.repository }}

0 commit comments

Comments
 (0)