-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: new release process with PRs #3567
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
61c4543
feat: new release process with PRs
amannocci 3261b91
chore: redirect to stderr for both message
amannocci 5d5617e
chore: apply suggest
amannocci e151fba
ci(chore): use env var instead of prefix v
amannocci e4ad2b3
ci: use maven wrapper instead of direct maven
amannocci 737b868
feat: validate snapshot for snapshot workflow
amannocci 4a4b4f9
docs: add new release process
amannocci File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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' | ||
amannocci marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 }} | ||
amannocci marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 }} | ||
amannocci marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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 }}" | ||
amannocci marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- 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 }}" | ||
amannocci marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 }}" | ||
amannocci marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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' | ||
amannocci marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit