Skip to content

Commit

Permalink
Add metafile.json to track version and checksum of artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
harrryr committed Dec 9, 2024
1 parent 425264c commit 3f4c393
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 2 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/post-release-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,27 @@ jobs:
sed -i'' -e "s/\"version\": \".*\"/\"version\": \"${DEV_VERSION}\"/" package.json
VERSION="${{ github.event.inputs.version }}"
npm install
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
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
git add .
git status
- name: Append latest release checksum to release-build-metadata.json
run: |
ARTIFACT_NAME="aws-aws-distro-opentelemetry-node-autoinstrumentation-${{ github.event.inputs.version }}.tgz"
curl -L -o $ARTIFACT_NAME https://github.com/aws-observability/aws-otel-js-instrumentation/releases/download/v${{ github.event.inputs.version }}/$ARTIFACT_NAME
CHECKSUM=$(shasum -a 256 $ARTIFACT_NAME | awk '{ print $1 }')
FILE="release-build-metadata.json"
UPDATED_JSON=$(jq --arg version "${{ env.VERSION }}" \
--arg name "$ARTIFACT_NAME" \
--arg checksum "$CHECKSUM" \
'.release += [{"version": $version, "checksum": [{"name": $name, "checksum": $checksum}]}]' "$FILE")
echo "$UPDATED_JSON" > "$FILE"
git add release-build-metadata.json
- name: Push changes to Github
run: |
git commit -m "Prepare main for next development cycle: Update version to $DEV_VERSION"
git push --set-upstream origin "prepare-main-for-next-dev-cycle-${VERSION}"
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,26 @@ jobs:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
run: npx lerna publish from-package --no-push --no-private --no-git-tag-version --no-verify-access --yes

- name: Get SHA256 checksum of wheel file
id: get_sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
checksum=$(shasum -a 256 aws-distro-opentelemetry-node-autoinstrumentation/aws-aws-distro-opentelemetry-node-autoinstrumentation-${{ github.event.inputs.version }}.tgz | awk '{ print $1 }')
echo "CHECKSUM=$checksum" >> $GITHUB_OUTPUT
- name: Append checksum and update version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "aws-aws-distro-opentelemetry-node-autoinstrumentation-${{ github.event.inputs.version }}.tgz ${{ steps.get_sha256.outputs.CHECKSUM }}" >> checksum.txt
echo "${{ github.event.inputs.version }}" > version.txt
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Action Release Workflow"
git add checksum.txt version.txt
git commit -m "Update latest version and append checksum"
git push

Empty file added checksum.txt
Empty file.
14 changes: 14 additions & 0 deletions release-build-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"release": [
{
"version": "0.3.0",
"checksum": [
{
"name": "aws-aws-distro-opentelemetry-node-autoinstrumentation-0.3.0.tgz",
"checksum": "22f0aabe7a24f57769c994acd57031caafbdbde46b3ca396372499055a7cb76c"
}
]
}
]
}

Empty file added version.txt
Empty file.

0 comments on commit 3f4c393

Please sign in to comment.