3434 type : boolean
3535 required : true
3636 default : false
37+ dry_run :
38+ description : If set, run a dry-run release
39+ default : false
40+ type : boolean
3741
3842env :
39- JAVA_VERSION : 17
40- JAVA_DIST : temurin
4143 TAG_NAME : v${{ inputs.version }}
4244
4345permissions :
@@ -68,21 +70,21 @@ jobs:
6870 with :
6971 ref : ${{ inputs.branch }}
7072 token : ${{ env.GITHUB_TOKEN }}
71- - name : Set up JDK ${{ env.JAVA_VERSION }}
72- uses : actions/setup-java@v4
73+ - name : Install JDK and mvn clean
74+ uses : ./.github/workflows/maven-goal
7375 with :
74- java-version : ${{ env.JAVA_VERSION }}
75- distribution : ${{ env.JAVA_DIST }}
76- cache : ' maven'
76+ command : ./mvnw clean
7777 - name : Prepare changelog for release
78- if : ${{ inputs.update_changelog }}
78+ if : ${{ inputs.update_changelog && ! inputs.dry_run }}
7979 run : |
8080 java .ci/ReleaseChangelog.java CHANGELOG.asciidoc ${{ inputs.version }}
8181 git commit -m "Prepare changelog for release ${{ inputs.version }}" CHANGELOG.asciidoc
8282 - name : Bump version and add git tag
83+ if : ${{ ! inputs.dry_run }}
8384 run : ./mvnw release:prepare -B -DpushChanges=false "-Darguments=-DskipTests -Dmaven.javadoc.skip=true" -DreleaseVersion=${{ inputs.version }}
84- - run : git push --atomic origin ${{ inputs.branch }} ${{ env.TAG_NAME }}
85-
85+ - name : Push changes
86+ if : ${{ ! inputs.dry_run }}
87+ run : git push --atomic origin ${{ inputs.branch }} ${{ env.TAG_NAME }}
8688
8789 maven_central_deploy :
8890 name : " Deploy to Maven Central (Buildkite)"
@@ -103,19 +105,16 @@ jobs:
103105 pipelineCommit : ${{ env.TAG_NAME }}
104106 waitFor : true
105107 printBuildLogs : false
106- # The action fails with .github/actions/buildkite/run.sh: line 24: 3: parameter missing.
107- # Which is an unexpected bug.
108- # Adding a random buildEnvVar to circumvent the behaviour.
109108 buildEnvVars : |
110- something_something=true
111-
109+ dry_run=${{ inputs.dry_run || 'false' }}
112110
113111 await_artifact_on_maven_central :
114112 name : " Wait for artifacts to be available on maven central"
115113 runs-on : ubuntu-latest
116114 steps :
117115 - uses : actions/checkout@v4
118116 - name : Await artifacts published in maven central
117+ if : ${{ ! inputs.dry_run }}
119118 shell : bash
120119 timeout-minutes : 120
121120 run : |
@@ -147,8 +146,11 @@ jobs:
147146 with :
148147 ref : ${{ env.TAG_NAME }}
149148 token : ${{ env.GITHUB_TOKEN }}
150- - run : .ci/release/update_major_branch.sh ${{ inputs.version }}
151- - run : git push -f origin "$(echo '${{ inputs.version }}' | sed -E 's/\..+/.x/')"
149+ - name : Update major branch
150+ run : .ci/release/update_major_branch.sh ${{ inputs.version }}
151+ - name : Push changes
152+ if : ${{ ! inputs.dry_run }}
153+ run : git push -f origin "$(echo '${{ inputs.version }}' | sed -E 's/\..+/.x/')"
152154
153155 update_cloudfoundry :
154156 name : " Update Cloudfoundry"
@@ -175,8 +177,9 @@ jobs:
175177 - name : " Update Cloudfoundry index.yml file"
176178 shell : bash
177179 run : .ci/release/update_cloudfoundry.sh ${{ inputs.version }}
178- - run : git push origin ${{ inputs.branch }}
179-
180+ - name : Push changes
181+ if : ${{ ! inputs.dry_run }}
182+ run : git push origin ${{ inputs.branch }}
180183
181184 build_and_push_docker_images :
182185 name : " Build and push docker images"
@@ -199,9 +202,11 @@ jobs:
199202 secretId : ${{ secrets.VAULT_SECRET_ID }}
200203 - name : " Build docker image"
201204 shell : bash
202- run : |
203- ./scripts/docker-release/build_docker.sh
204- ./scripts/docker-release/push_docker.sh
205+ run : ./scripts/docker-release/build_docker.sh
206+ - name : " Push docker image"
207+ if : ${{ ! inputs.dry_run }}
208+ shell : bash
209+ run : ./scripts/docker-release/push_docker.sh
205210
206211 publish_aws_lambda :
207212 name : " Publish AWS Lambda"
@@ -218,14 +223,10 @@ jobs:
218223 - uses : actions/checkout@v4
219224 with :
220225 ref : ${{ env.TAG_NAME }}
221- - name : Set up JDK ${{ env.JAVA_VERSION }}
222- uses : actions/setup-java@v4
223- with :
224- java-version : ${{ env.JAVA_VERSION }}
225- distribution : ${{ env.JAVA_DIST }}
226- cache : ' maven'
227226 - name : Build Lambda-layer zip using agent from maven-central
228- run : ./mvnw dependency:purge-local-repository package -pl apm-agent-lambda-layer
227+ uses : ./.github/workflows/maven-goal
228+ with :
229+ command : ./mvnw dependency:purge-local-repository package -pl apm-agent-lambda-layer
229230 -
uses :
hashicorp/[email protected] 230231 with :
231232 url : ${{ secrets.VAULT_ADDR }}
@@ -236,30 +237,33 @@ jobs:
236237 secret/observability-team/ci/service-account/apm-aws-lambda access_key_id | AWS_ACCESS_KEY_ID ;
237238 secret/observability-team/ci/service-account/apm-aws-lambda secret_access_key | AWS_SECRET_ACCESS_KEY
238239 - name : Publish
240+ if : ${{ ! inputs.dry_run }}
239241 run : |
240242 # Convert v1.2.3 to ver-1-2-3
241243 VERSION=${TAG_NAME/v/ver-}
242244 VERSION=${VERSION//./-}
243245
244246 ELASTIC_LAYER_NAME="elastic-apm-java-${VERSION}" .ci/publish-aws.sh
245247 - uses : actions/upload-artifact@v4
248+ if : ${{ ! inputs.dry_run }}
246249 with :
247250 name : arn-file
248251 path : .ci/.arn-file.md
249252 - name : Add ARN file to output
253+ if : ${{ ! inputs.dry_run }}
250254 id : arn_output
251255 run : |
252256 echo 'arn_content<<ARN_CONTENT_EOF' >> $GITHUB_OUTPUT
253257 cat .ci/.arn-file.md >> $GITHUB_OUTPUT
254258 echo 'ARN_CONTENT_EOF' >> $GITHUB_OUTPUT
255259
256-
257260 create_github_release :
258261 name : " Create GitHub Release"
259262 needs :
260263 - publish_aws_lambda
261264 - update_major_branch
262265 runs-on : ubuntu-latest
266+ if : ${{ ! inputs.dry_run }}
263267 permissions :
264268 contents : write
265269 steps :
@@ -286,10 +290,9 @@ jobs:
286290 --title="Release ${{ inputs.version }}" \
287291 --notes="[Release Notes for ${{ inputs.version }}](https://www.elastic.co/guide/en/apm/agent/java/current/release-notes-${{ steps.get_dotx_branch.outputs.dotx_branch }}.html#release-notes-${{ inputs.version }})
288292 ${{ needs.publish_aws_lambda.outputs.arn_content }}"
289-
290293
291294 notify :
292- if : always()
295+ if : ${{ always() && ! inputs.dry_run }}
293296 needs :
294297 - prepare_release
295298 - maven_central_deploy
0 commit comments