Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 57 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ permissions:
id-token: write
contents: write
issues: write
pull-requests: write

jobs:
build:
Expand All @@ -35,7 +36,7 @@ jobs:

steps:
- name: Set up JDK
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: 11
distribution: temurin
Expand All @@ -47,7 +48,7 @@ jobs:
run: ./gradlew --parallel --max-workers 2 build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ secrets.RELEASE_IAM_ROLE }}
aws-region: us-east-1
Expand All @@ -66,7 +67,7 @@ jobs:

- name: Log into Amazon ECR Public
id: login-ecr
uses: docker/login-action@v1
uses: docker/login-action@v4
with:
registry: public.ecr.aws
env:
Expand Down Expand Up @@ -134,12 +135,17 @@ jobs:
permissions:
contents: write
issues: write
outputs:
version: ${{ steps.get_version.outputs.version }}

steps:
- name: Checkout Data Prepper
uses: actions/checkout@v6
- name: Get Version
run: grep '^version=' gradle.properties >> $GITHUB_ENV
id: get_version
run: |
grep '^version=' gradle.properties >> $GITHUB_ENV
echo "version=$(grep '^version=' gradle.properties | cut -d'=' -f2)" >> $GITHUB_OUTPUT

- name: Get Approvers
id: get_approvers
Expand Down Expand Up @@ -191,3 +197,50 @@ jobs:
tag_name: 'refs/tags/${{ env.version }}'
files: |
release-description.yaml

generate-changelog:
runs-on: ubuntu-latest
needs: promote

steps:
- name: Checkout Data Prepper
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false

- name: Fetch Tags
run: git fetch origin --tags

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install git-release-notes
run: npm install -g git-release-notes

- name: Generate Changelog
run: release/script/changelog/generate-changelog.sh ${{ needs.promote.outputs.version }}

- name: GitHub App token
id: github_app_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.github_app_token.outputs.token }}
add-paths: |
release/release-notes/data-prepper.change-log-${{ needs.promote.outputs.version }}.md
commit-message: 'Add Data Prepper ${{ needs.promote.outputs.version }} changelog.'
signoff: true
branch: changelog-${{ needs.promote.outputs.version }}
delete-branch: true
base: main
title: 'Data Prepper ${{ needs.promote.outputs.version }} changelog'
body: |
Adds the Data Prepper ${{ needs.promote.outputs.version }} changelog generated by git-release-notes.
45 changes: 45 additions & 0 deletions release/script/changelog/generate-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

#
# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#

# Generates a changelog for a Data Prepper release using git-release-notes.
#
# Usage: generate-changelog.sh <version>
#
# The previous version is determined automatically from existing git tags.
# Requires git-release-notes to be installed (npm install -g git-release-notes).

set -e

VERSION=$1

if [ -z "$VERSION" ]; then
echo "Usage: $0 <version>"
echo " <version> The release version (e.g. 2.15.0)"
exit 1
fi

PREVIOUS_VERSION=$(git tag --sort=-version:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | awk -v ver="$VERSION" 'found {print; exit} $0 == ver {found=1}')

if [ -z "$PREVIOUS_VERSION" ]; then
echo "Error: Could not determine the previous version from git tags."
echo "Make sure the tag '$VERSION' exists and there is an earlier release tag."
exit 1
fi

echo "Generating changelog for ${PREVIOUS_VERSION}..${VERSION}"

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
OUTPUT_FILE="${REPO_ROOT}/release/release-notes/data-prepper.change-log-${VERSION}.md"

git-release-notes "${PREVIOUS_VERSION}..${VERSION}" markdown > "$OUTPUT_FILE"

echo "Changelog written to $OUTPUT_FILE"
Loading