Skip to content

Commit 3f4c393

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

File tree

5 files changed

+55
-2
lines changed

5 files changed

+55
-2
lines changed

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,27 @@ jobs:
107107
sed -i'' -e "s/\"version\": \".*\"/\"version\": \"${DEV_VERSION}\"/" package.json
108108
VERSION="${{ github.event.inputs.version }}"
109109
npm install
110-
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
110+
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-${{ github.event.inputs.version }}.tgz"
116+
curl -L -o $ARTIFACT_NAME https://github.com/aws-observability/aws-otel-js-instrumentation/releases/download/v${{ github.event.inputs.version }}/$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

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