-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: new release process Signed-off-by: Adrien Mannocci <[email protected]> * feat: use a global maven config file Signed-off-by: Adrien Mannocci <[email protected]> * chore: execute package goal for dry-run release Signed-off-by: Adrien Mannocci <[email protected]> * ci: align pr title creation for release Signed-off-by: Adrien Mannocci <[email protected]> * ci: add parameter documentations in CI scripts Signed-off-by: Adrien Mannocci <[email protected]> * ci: centralize maven goal execution Signed-off-by: Adrien Mannocci <[email protected]> * fix: use directly java-version without file Signed-off-by: Adrien Mannocci <[email protected]> * ci: refactor using a reusable workflow Signed-off-by: Adrien Mannocci <[email protected]> * refactor: avoid duplicate hardcode branch name Signed-off-by: Adrien Mannocci <[email protected]> * ci: create summary file in any case Signed-off-by: Adrien Mannocci <[email protected]> * feat: validate tag before anything Signed-off-by: Adrien Mannocci <[email protected]> * chore: apply suggestions Signed-off-by: Adrien Mannocci <[email protected]> * fix: validate correctly tags Signed-off-by: Adrien Mannocci <[email protected]> * chore: add validation for tag and project version Signed-off-by: Adrien Mannocci <[email protected]> --------- Signed-off-by: Adrien Mannocci <[email protected]>
- Loading branch information
Showing
10 changed files
with
242 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
|
||
name: maven-goal | ||
description: Install specific JDK and run a command | ||
|
||
inputs: | ||
version: | ||
description: 'Java version' | ||
required: true | ||
default: '17' | ||
distribution: | ||
description: 'Java distribution' | ||
required: true | ||
default: 'temurin' | ||
command: | ||
description: 'Command to execute' | ||
required: true | ||
shell: | ||
description: 'Default shell' | ||
default: 'bash' | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ inputs.version }} | ||
distribution: ${{ inputs.distribution }} | ||
cache: 'maven' | ||
- run: ${{ inputs.command }} | ||
shell: ${{ inputs.shell }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
--- | ||
name: Pre/Post Release | ||
|
||
on: | ||
workflow_call: | ||
ref: | ||
description: 'Branch or tag ref to run the workflow on' | ||
required: true | ||
default: 'main' | ||
version: | ||
description: 'The version to release (e.g. 1.2.3). This workflow will automatically perform the required version bumps' | ||
required: true | ||
phase: | ||
description: 'Pre or post release phase' | ||
type: choice | ||
options: | ||
- pre | ||
- post | ||
required: true | ||
|
||
env: | ||
RELEASE_VERSION: ${{ inputs.version }} | ||
BRANCH_NAME: ${{ inputs.phase }}-release-v${{ inputs.version }} | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
|
||
jobs: | ||
validate-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Validate tag does not exist on current commit | ||
uses: ./.github/workflows/validate-tag | ||
with: | ||
tag: v${{ env.RELEASE_VERSION }} | ||
|
||
create-pr: | ||
name: "Bump versions and create PR" | ||
runs-on: ubuntu-latest | ||
needs: | ||
- validate-tag | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: elastic/apm-pipeline-library/.github/actions/github-token@current | ||
with: | ||
url: ${{ secrets.VAULT_ADDR }} | ||
roleId: ${{ secrets.VAULT_ROLE_ID }} | ||
secretId: ${{ secrets.VAULT_SECRET_ID }} | ||
|
||
- uses: elastic/apm-pipeline-library/.github/actions/setup-git@current | ||
with: | ||
username: ${{ env.GIT_USER }} | ||
email: ${{ env.GIT_EMAIL }} | ||
token: ${{ env.GITHUB_TOKEN }} | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
token: ${{ env.GITHUB_TOKEN }} | ||
|
||
- name: Create the release tag (post phase) | ||
if: inputs.phase == 'post' | ||
run: | | ||
git tag "v${{ env.RELEASE_VERSION }}" | ||
git push origin "v${{ env.RELEASE_VERSION }}" | ||
- name: Create a ${{ inputs.phase }} release branch | ||
run: git checkout -b ${{ env.BRANCH_NAME }} | ||
|
||
- name: Set release version (pre release) | ||
if: inputs.phase == 'pre' | ||
uses: ./.github/workflows/maven-goal | ||
with: | ||
command: ./mvnw -V versions:set -DprocessAllModules=true -DgenerateBackupPoms=false -DnewVersion=${{ env.RELEASE_VERSION }} | ||
|
||
- name: Set next snapshot version (post release) | ||
if: inputs.phase == 'post' | ||
uses: ./.github/workflows/maven-goal | ||
with: | ||
command: ./mvnw -V versions:set -DprocessAllModules=true -DgenerateBackupPoms=false -nextSnapshot=true | ||
|
||
- name: Push the ${{ inputs.phase }} release branch | ||
run: | | ||
git add --all | ||
git commit -m "${{ inputs.phase }} release: ecs-logging-java v${{ env.RELEASE_VERSION }}" | ||
git push origin ${{ env.BRANCH_NAME }} | ||
- name: Create the ${{ inputs.phase }} release PR | ||
run: gh pr create --title="${{ inputs.phase }} release v${{ env.RELEASE_VERSION }}" --base main --head ${{ env.BRANCH_NAME }} -b "${{ inputs.phase }} release v${{ env.RELEASE_VERSION }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
name: Pre release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
ref: | ||
description: 'Branch or tag ref to run the workflow on' | ||
required: true | ||
default: 'main' | ||
version: | ||
description: 'The version to release (e.g. 1.2.3). This workflow will automatically perform the required version bumps' | ||
required: true | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
|
||
jobs: | ||
pre-release: | ||
name: "Bump versions and create PR" | ||
uses: ./.github/workflows/pre-post-release.yml | ||
with: | ||
ref: ${{ inputs.ref }} | ||
version: ${{ inputs.version }} | ||
phase: 'pre' | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
|
||
name: validate-tag | ||
description: Validate tag format | ||
|
||
inputs: | ||
tag: | ||
description: 'Tag to validate' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Validate tag does not exist on current commit | ||
id: validate-tag | ||
shell: 'bash' | ||
run: | | ||
if ! [ $(echo "${{ inputs.tag }}" | grep -P "(\d{1,2})\.(\d{1,2})\.(\d{1,2})") ]; then | ||
echo "Tag should be a SemVer format" | ||
exit 1 | ||
fi | ||
if [ $(git tag -l "${{ inputs.tag }}") ]; then | ||
echo "The tag ${{ inputs.tag }} already exists" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-B | ||
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | ||
-Dhttps.protocols=TLSv1.2 | ||
-Dmaven.wagon.http.retryHandler.count=3 | ||
-Dmaven.wagon.httpconnectionManager.ttlSeconds=25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters