Skip to content
Closed
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
32 changes: 25 additions & 7 deletions .github/workflows/post_release_version_bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:

env:
AWS_DEFAULT_REGION: us-east-1
VERSION_INPUT: ${{ env.VERSION_INPUT }}
IS_PATCH_INPUT: ${{ github.event.inputs.is_patch }}

permissions:
id-token: write
Expand All @@ -27,8 +29,8 @@ jobs:

- name: Extract Major.Minor Version and setup Env variable
run: |
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
echo "VERSION=${{ env.VERSION_INPUT }}" >> $GITHUB_ENV
echo "MAJOR_MINOR=$(echo ${{ env.VERSION_INPUT }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV

- name: Get current major.minor version from main branch
id: get_version
Expand Down Expand Up @@ -84,8 +86,8 @@ jobs:

- name: Extract Major.Minor Version and setup Env variable
run: |
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
echo "VERSION=${{ env.VERSION_INPUT }}" >> $GITHUB_ENV
echo "MAJOR_MINOR=$(echo ${{ env.VERSION_INPUT }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV

- name: Determine release branch and checkout
run: |
Expand All @@ -96,10 +98,26 @@ jobs:
- name: Update version to next development version in main
# TODO update version in daily_scan.yml
run: |
DEV_VERSION="${{ github.event.inputs.version }}.dev0"
DEV_VERSION="${{ env.VERSION_INPUT }}.dev0"
sed -i "s/public static string version = \".*\";/public static string version = \"${DEV_VERSION}\";/" src/AWS.Distro.OpenTelemetry.AutoInstrumentation/Version.cs
sed -i "s/private readonly string version = \".*\";/private readonly string version = \"${DEV_VERSION}\";/" build/Build.InstallationScripts.cs
VERSION="${{ github.event.inputs.version }}"
<<<<<<< HEAD:.github/workflows/post_release_version_bump.yml
VERSION="${{ env.VERSION_INPUT }}"
=======
VERSION="${{ env.VERSION_INPUT }}"
sed -i -e 's/dotnet:v.*"/dotnet:v'$VERSION'"/' .github/workflows/daily-scan.yml

# for patch releases, avoid merge conflict by manually resolving CHANGELOG with main
if [[ "${{ env.IS_PATCH_INPUT }}" == "true" ]]; then
# Copy the patch release entries
sed -n "/^## v${VERSION}/,/^## v[0-9]/p" CHANGELOG.md | sed '$d' > /tmp/patch_release_section.txt
git fetch origin main
git show origin/main:CHANGELOG.md > CHANGELOG.md
# Insert the patch release entries after Unreleased
awk -i inplace '/^## v[0-9]/ && !inserted { system("cat /tmp/patch_release_section.txt"); inserted=1 } {print}' CHANGELOG.md
fi

>>>>>>> 371c614 (fix: prevent script injection in workflows (#318)):.github/workflows/post-release-version-bump.yml
git add src/AWS.Distro.OpenTelemetry.AutoInstrumentation/Version.cs
git add build/Build.InstallationScripts.cs
git commit -m "Prepare main for next development cycle: Update version to $DEV_VERSION"
Expand All @@ -109,7 +127,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
run: |
DEV_VERSION="${{ github.event.inputs.version }}.dev0"
DEV_VERSION="${{ env.VERSION_INPUT }}.dev0"
gh pr create --title "Post release $VERSION: Update version to $DEV_VERSION" \
--body "This PR prepares the main branch for the next development cycle by updating the version to $DEV_VERSION and updating the image version to be scanned to the latest released.

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/pre_release_prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ on:

env:
AWS_DEFAULT_REGION: us-east-1
VERSION_INPUT: ${{ env.VERSION_INPUT }}
IS_PATCH_INPUT: ${{ env.IS_PATCH_INPUT }}

permissions:
contents: write
Expand Down Expand Up @@ -52,12 +54,12 @@ jobs:

- name: Extract Major.Minor Version and setup Env variable
run: |
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
echo "VERSION=${{ env.VERSION_INPUT }}" >> $GITHUB_ENV
echo "MAJOR_MINOR=$(echo ${{ env.VERSION_INPUT }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV

- name: Create branches
run: |
IS_PATCH=${{ github.event.inputs.is_patch }}
IS_PATCH=${{ env.IS_PATCH_INPUT }}
if [[ "$IS_PATCH" != "true" && "$IS_PATCH" != "false" ]]; then
echo "Invalid input for IS_PATCH. Must be 'true' or 'false'."
exit 1
Expand Down Expand Up @@ -103,5 +105,5 @@ jobs:
--body "This PR updates the version to ${VERSION}.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
--head v${{ github.event.inputs.version }}_release \
--head v${{ env.VERSION_INPUT }}_release \
--base release/v${MAJOR_MINOR}.x
Loading
Loading