Skip to content

Commit 7d8595e

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

File tree

5 files changed

+63
-9
lines changed

5 files changed

+63
-9
lines changed

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

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727

2828
- name: Extract Major.Minor Version and setup Env variable
2929
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
30+
echo "VERSION=0.3.0" >> $GITHUB_ENV
31+
echo "MAJOR_MINOR=$(echo 0.3.0 | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
3232
3333
- name: Get current major.minor version from main branch
3434
id: get_version
@@ -85,8 +85,8 @@ jobs:
8585
8686
- name: Extract Major.Minor Version and setup Env variable
8787
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
88+
echo "VERSION=0.3.0" >> $GITHUB_ENV
89+
echo "MAJOR_MINOR=$(echo 0.3.0 | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
9090
9191
- name: Determine release branch and checkout
9292
run: |
@@ -101,28 +101,47 @@ jobs:
101101

102102
- name: Update version to next development version in main
103103
run: |
104-
DEV_VERSION="${{ github.event.inputs.version }}-dev0"
104+
DEV_VERSION="0.3.0-dev0"
105105
sed -i'' -e "s/\"version\": \".*\"/\"version\": \"${DEV_VERSION}\"/" aws-distro-opentelemetry-node-autoinstrumentation/package.json
106106
sed -i'' -e "s/\"version\": \".*\"/\"version\": \"${DEV_VERSION}\"/" docker-utils/package.json
107107
sed -i'' -e "s/\"version\": \".*\"/\"version\": \"${DEV_VERSION}\"/" package.json
108-
VERSION="${{ github.event.inputs.version }}"
108+
VERSION="0.3.0"
109109
npm install
110110
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
111111
git add .
112-
git status
112+
113+
- name: Append latest release checksum to release-build-metadata.json
114+
run: |
115+
ARTIFACT_NAME="aws-aws-distro-opentelemetry-node-autoinstrumentation-0.3.0.tgz"
116+
curl -L -o $ARTIFACT_NAME https://github.com/aws-observability/aws-otel-js-instrumentation/releases/download/v0.3.0/$ARTIFACT_NAME
117+
118+
CHECKSUM=$(shasum -a 256 $ARTIFACT_NAME | awk '{ print $1 }')
119+
120+
FILE="release-build-metadata.json"
121+
UPDATED_JSON=$(jq --arg version "${{ env.VERSION }}" \
122+
--arg name "$ARTIFACT_NAME" \
123+
--arg checksum "$CHECKSUM" \
124+
'.release += [{"version": $version, "checksum": [{"name": $name, "checksum": $checksum}]}]' "$FILE")
125+
126+
echo "$UPDATED_JSON" > "$FILE"
127+
git add release-build-metadata.json
128+
129+
- name: Push changes to Github
130+
run: |
113131
git commit -m "Prepare main for next development cycle: Update version to $DEV_VERSION"
114132
git push --set-upstream origin "prepare-main-for-next-dev-cycle-${VERSION}"
115133
116134
- name: Create Pull Request to main
117135
env:
118136
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
119137
run: |
120-
DEV_VERSION="${{ github.event.inputs.version }}-dev0"
138+
DEV_VERSION="0.3.0-dev0"
121139
gh pr create --title "Post release $VERSION: Update version to $DEV_VERSION" \
122140
--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.
123141
124142
This PR should only be merge when release for version v$VERSION is success.
125143
126144
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
127145
--head prepare-main-for-next-dev-cycle-${VERSION} \
128-
--base main
146+
--base main
147+

.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)