-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Adrien Mannocci <[email protected]>
- Loading branch information
Showing
12 changed files
with
299 additions
and
179 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Bash strict mode | ||
set -euo pipefail | ||
|
||
# Found current script directory | ||
RELATIVE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
# Found project directory | ||
BASE_PROJECT="$(dirname $(dirname "${RELATIVE_DIR}"))" | ||
|
||
# Import dependencies | ||
source "${RELATIVE_DIR}/util.sh" | ||
|
||
# Constants | ||
BASE_URL="https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent" | ||
CF_FILE="${BASE_PROJECT}/cloudfoundry/index.yml" | ||
|
||
# Requirements | ||
check_version "${RELEASE_VERSION}" | ||
|
||
echo "Set next snapshot version" | ||
./mvnw -V versions:set -DprocessAllModules=true -DgenerateBackupPoms=false -DnextSnapshot=true | ||
|
||
# make script idempotent if release is already in CF descriptor | ||
set +e | ||
grep -e "^${RELEASE_VERSION}:" ${CF_FILE} | ||
[[ $? == 0 ]] && exit 0 | ||
set -e | ||
echo "Update cloudfoundry version" | ||
echo "${RELEASE_VERSION}: ${BASE_URL}/${RELEASE_VERSION}/elastic-apm-agent-${RELEASE_VERSION}.jar" >> "${CF_FILE}" |
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Bash strict mode | ||
set -euo pipefail | ||
|
||
# Found current script directory | ||
RELATIVE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
# Found project directory | ||
BASE_PROJECT="$(dirname $(dirname "${RELATIVE_DIR}"))" | ||
|
||
# Import dependencies | ||
source "${RELATIVE_DIR}/util.sh" | ||
|
||
# Requirements | ||
check_version "${RELEASE_VERSION}" | ||
|
||
echo "Set release version" | ||
./mvnw -V versions:set -DprocessAllModules=true -DgenerateBackupPoms=false -DnewVersion="${RELEASE_VERSION}" | ||
|
||
echo "Prepare changelog for release" | ||
java "${BASE_PROJECT}/.ci/ReleaseChangelog.java" CHANGELOG.asciidoc "${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
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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: | ||
inputs: | ||
ref: | ||
description: 'Branch or tag ref to run the workflow on' | ||
type: string | ||
required: true | ||
default: 'main' | ||
version: | ||
description: 'The version to release (e.g. 1.2.3). This workflow will automatically perform the required version bumps' | ||
type: string | ||
required: true | ||
phase: | ||
description: 'Pre or post release phase' | ||
type: string # valid values are 'pre' or 'post' | ||
required: true | ||
|
||
env: | ||
RELEASE_VERSION: ${{ inputs.version }} | ||
BRANCH_NAME: ${{ inputs.phase }}-release-v${{ inputs.version }} | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
validate-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Validate release tag does not exist in repo | ||
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: Perform pre release changes | ||
if: inputs.phase == 'pre' | ||
uses: ./.github/workflows/maven-goal-jdk | ||
with: | ||
command: ./.ci/release/pre-release.sh | ||
|
||
- name: Perform post release changes | ||
if: inputs.phase == 'post' | ||
uses: ./.github/workflows/maven-goal | ||
with: | ||
command: ./.ci/release/post-release.sh | ||
|
||
- name: Push the ${{ inputs.phase }} release branch | ||
run: | | ||
git add --all | ||
git commit -m "${{ inputs.phase }} release: elastic-apm-agent 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 }}" | ||
env: | ||
GH_TOKEN: ${{ env.GITHUB_TOKEN }} |
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,32 @@ | ||
--- | ||
|
||
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 | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
|
||
jobs: | ||
pre-release: | ||
name: "Bump versions and create PR" | ||
uses: ./.github/workflows/pre-post-release.yml | ||
permissions: | ||
contents: write | ||
with: | ||
ref: ${{ inputs.ref }} | ||
version: ${{ inputs.version }} | ||
phase: 'pre' | ||
secrets: inherit |
Oops, something went wrong.