Skip to content

Commit 45fc56c

Browse files
authored
Remove github.event.inputs. from pre/post release workflows (#316)
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent e553218 commit 45fc56c

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

.github/workflows/post-release-version-bump.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ on:
1313

1414
env:
1515
AWS_DEFAULT_REGION: us-east-1
16+
VERSION: ${{ github.event.inputs.version }}
17+
IS_PATCH: ${{ github.event.inputs.is_patch }}
1618

1719
permissions:
1820
id-token: write
@@ -31,8 +33,7 @@ jobs:
3133

3234
- name: Extract Major.Minor Version and setup Env variable
3335
run: |
34-
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
35-
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
36+
echo "MAJOR_MINOR=$(echo ${{ env.VERSION }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
3637
3738
- name: Get current major.minor version from main branch
3839
id: get_version
@@ -89,8 +90,7 @@ jobs:
8990
9091
- name: Extract Major.Minor Version and setup Env variable
9192
run: |
92-
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
93-
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
93+
echo "MAJOR_MINOR=$(echo ${{ env.VERSION }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
9494
9595
- name: Determine release branch and checkout
9696
run: |
@@ -105,17 +105,17 @@ jobs:
105105

106106
- name: Update version to next development version in main
107107
run: |
108-
DEV_VERSION="${{ github.event.inputs.version }}-dev0"
108+
DEV_VERSION="${{ env.VERSION }}-dev0"
109109
sed -i'' -e "s/\"version\": \".*\"/\"version\": \"${DEV_VERSION}\"/" aws-distro-opentelemetry-node-autoinstrumentation/package.json
110110
sed -i'' -e "s/\"version\": \".*\"/\"version\": \"${DEV_VERSION}\"/" docker-utils/package.json
111111
sed -i'' -e "s/\"version\": \".*\"/\"version\": \"${DEV_VERSION}\"/" package.json
112112
sed -i'' -e "s/aws-aws-distro-opentelemetry-node-autoinstrumentation-[0-9]\+\.[0-9]\+\.[0-9]\+\([0-9A-Za-z-]\+\)\?\.tgz/aws-aws-distro-opentelemetry-node-autoinstrumentation-${DEV_VERSION}.tgz/" lambda-layer/packages/layer/package.json
113-
VERSION="${{ github.event.inputs.version }}"
113+
VERSION="${{ env.VERSION }}"
114114
npm install
115-
sed -i "s|\(/aws-observability/adot-autoinstrumentation-node:\)v[0-9]\+\.[0-9]\+\.[0-9]\+|\1v${{github.event.inputs.version}}|g" .github/workflows/daily-scan.yml
115+
sed -i "s|\(/aws-observability/adot-autoinstrumentation-node:\)v[0-9]\+\.[0-9]\+\.[0-9]\+|\1v${{ env.VERSION }}|g" .github/workflows/daily-scan.yml
116116
117117
# for patch releases, avoid merge conflict by manually resolving CHANGELOG with main
118-
if [[ "${{ github.event.inputs.is_patch }}" == "true" ]]; then
118+
if [[ "${{ env.IS_PATCH }}" == "true" ]]; then
119119
# Copy the patch release entries
120120
sed -n "/^## v${VERSION}/,/^## v[0-9]/p" CHANGELOG.md | sed '$d' > /tmp/patch_release_section.txt
121121
git fetch origin main
@@ -133,7 +133,7 @@ jobs:
133133
env:
134134
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
135135
run: |
136-
DEV_VERSION="${{ github.event.inputs.version }}-dev0"
136+
DEV_VERSION="${{ env.VERSION }}-dev0"
137137
gh pr create --title "Post release $VERSION: Update version to $DEV_VERSION" \
138138
--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.
139139
@@ -151,4 +151,4 @@ jobs:
151151
if ! git diff --quiet --cached; then
152152
git commit -m "Force our CHANGELOG to override merge conflicts"
153153
git push origin "prepare-main-for-next-dev-cycle-${VERSION}"
154-
fi
154+
fi

.github/workflows/pre-release-prepare.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ on:
1313

1414
env:
1515
AWS_DEFAULT_REGION: us-east-1
16+
VERSION: ${{ github.event.inputs.version }}
17+
IS_PATCH: ${{ github.event.inputs.is_patch }}
1618

1719
permissions:
1820
contents: write
@@ -51,12 +53,11 @@ jobs:
5153
5254
- name: Extract Major.Minor Version and setup Env variable
5355
run: |
54-
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
55-
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
56+
echo "MAJOR_MINOR=$(echo ${{ env.VERSION }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
5657
5758
- name: Create branches
5859
run: |
59-
IS_PATCH=${{ github.event.inputs.is_patch }}
60+
IS_PATCH=${{ env.IS_PATCH }}
6061
if [[ "$IS_PATCH" != "true" && "$IS_PATCH" != "false" ]]; then
6162
echo "Invalid input for IS_PATCH. Must be 'true' or 'false'."
6263
exit 1
@@ -118,5 +119,5 @@ jobs:
118119
--body "This PR updates the version to ${VERSION}.
119120
120121
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
121-
--head v${{ github.event.inputs.version }}_release \
122-
--base release/v${MAJOR_MINOR}.x
122+
--head v${{ env.VERSION }}_release \
123+
--base release/v${MAJOR_MINOR}.x

0 commit comments

Comments
 (0)