Skip to content

Commit d4298ca

Browse files
committed
Add metafile.json to track version and checksum of artifacts
1 parent 425264c commit d4298ca

File tree

5 files changed

+62
-8
lines changed

5 files changed

+62
-8
lines changed

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

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
version:
77
description: 'Version number (e.g., 1.0.1)'
88
required: true
9+
push:
910

1011
env:
1112
AWS_DEFAULT_REGION: us-east-1
@@ -27,8 +28,8 @@ jobs:
2728

2829
- name: Extract Major.Minor Version and setup Env variable
2930
run: |
30-
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
31-
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
31+
echo "VERSION=0.3.0" >> $GITHUB_ENV
32+
echo "MAJOR_MINOR=$(echo 0.3.0 | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
3233
3334
- name: Get current major.minor version from main branch
3435
id: get_version
@@ -85,8 +86,8 @@ jobs:
8586
8687
- name: Extract Major.Minor Version and setup Env variable
8788
run: |
88-
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
89-
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
89+
echo "VERSION=0.3.0" >> $GITHUB_ENV
90+
echo "MAJOR_MINOR=$(echo 0.3.0 | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
9091
9192
- name: Determine release branch and checkout
9293
run: |
@@ -101,23 +102,41 @@ jobs:
101102

102103
- name: Update version to next development version in main
103104
run: |
104-
DEV_VERSION="${{ github.event.inputs.version }}-dev0"
105+
DEV_VERSION="0.3.0-dev0"
105106
sed -i'' -e "s/\"version\": \".*\"/\"version\": \"${DEV_VERSION}\"/" aws-distro-opentelemetry-node-autoinstrumentation/package.json
106107
sed -i'' -e "s/\"version\": \".*\"/\"version\": \"${DEV_VERSION}\"/" docker-utils/package.json
107108
sed -i'' -e "s/\"version\": \".*\"/\"version\": \"${DEV_VERSION}\"/" package.json
108-
VERSION="${{ github.event.inputs.version }}"
109+
VERSION="0.3.0"
109110
npm install
110111
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
111112
git add .
112-
git status
113+
114+
- name: Append latest release checksum to release-build-metadata.json
115+
run: |
116+
ARTIFACT_NAME="aws-aws-distro-opentelemetry-node-autoinstrumentation-0.3.0.tgz"
117+
curl -L -o $ARTIFACT_NAME https://github.com/aws-observability/aws-otel-js-instrumentation/releases/download/v0.3.0/$ARTIFACT_NAME
118+
119+
CHECKSUM=$(shasum -a 256 $ARTIFACT_NAME | awk '{ print $1 }')
120+
121+
FILE="release-build-metadata.json"
122+
UPDATED_JSON=$(jq --arg version "${{ env.VERSION }}" \
123+
--arg name "$ARTIFACT_NAME" \
124+
--arg checksum "$CHECKSUM" \
125+
'.release += [{"version": $version, "checksum": [{"name": $name, "checksum": $checksum}]}]' "$FILE")
126+
127+
echo "$UPDATED_JSON" > "$FILE"
128+
git add release-build-metadata.json
129+
130+
- name: Push changes to Github
131+
run: |
113132
git commit -m "Prepare main for next development cycle: Update version to $DEV_VERSION"
114133
git push --set-upstream origin "prepare-main-for-next-dev-cycle-${VERSION}"
115134
116135
- name: Create Pull Request to main
117136
env:
118137
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
119138
run: |
120-
DEV_VERSION="${{ github.event.inputs.version }}-dev0"
139+
DEV_VERSION="0.3.0-dev0"
121140
gh pr create --title "Post release $VERSION: Update version to $DEV_VERSION" \
122141
--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.
123142

.github/workflows/release-build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,26 @@ jobs:
104104
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
105105
NPM_CONFIG_PROVENANCE: true
106106
run: npx lerna publish from-package --no-push --no-private --no-git-tag-version --no-verify-access --yes
107+
108+
- name: Get SHA256 checksum of wheel file
109+
id: get_sha256
110+
env:
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
run: |
113+
checksum=$(shasum -a 256 aws-distro-opentelemetry-node-autoinstrumentation/aws-aws-distro-opentelemetry-node-autoinstrumentation-${{ github.event.inputs.version }}.tgz | awk '{ print $1 }')
114+
echo "CHECKSUM=$checksum" >> $GITHUB_OUTPUT
115+
116+
- name: Append checksum and update version
117+
env:
118+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
run: |
120+
echo "aws-aws-distro-opentelemetry-node-autoinstrumentation-${{ github.event.inputs.version }}.tgz ${{ steps.get_sha256.outputs.CHECKSUM }}" >> checksum.txt
121+
echo "${{ github.event.inputs.version }}" > version.txt
122+
123+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
124+
git config --local user.name "GitHub Action Release Workflow"
125+
git add checksum.txt version.txt
126+
git commit -m "Update latest version and append checksum"
127+
git push
107128
108129

checksum.txt

Whitespace-only changes.

release-build-metadata.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"release": [
3+
{
4+
"version": "0.3.0",
5+
"checksum": [
6+
{
7+
"name": "aws-aws-distro-opentelemetry-node-autoinstrumentation-0.3.0.tgz",
8+
"checksum": "22f0aabe7a24f57769c994acd57031caafbdbde46b3ca396372499055a7cb76c"
9+
}
10+
]
11+
}
12+
]
13+
}
14+

version.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)