3232 environment : Release
3333 runs-on : ubuntu-latest
3434 steps :
35- - name : Checkout Contrib Repo @ SHA - ${{ github.sha }}
35+ - name : Checkout Repo @ SHA - ${{ github.sha }}
3636 uses : actions/checkout@v4
3737
3838 - name : Check main build status
6363 package_name : aws-distro-opentelemetry-node-autoinstrumentation
6464 os : ubuntu-latest
6565
66+ - name : Upload SDK Tarball
67+ uses : actions/upload-artifact@v4
68+ with :
69+ name : ${{ env.ARTIFACT_NAME }}
70+ path : aws-distro-opentelemetry-node-autoinstrumentation/${{ env.ARTIFACT_NAME }}
71+
6672 # TODO: Add some sort of smoke/integration testing before we go
6773 # release the artifacts. adot java for reference:
6874 # https://github.com/aws-observability/aws-otel-java-instrumentation/tree/93870a550ac30988fbdd5d3bf1e8f9f1b37916f5/smoke-tests
75+
76+ build-layer :
77+ needs : build
78+ runs-on : ubuntu-latest
79+ outputs :
80+ aws_regions_json : ${{ steps.set-matrix.outputs.aws_regions_json }}
81+ steps :
82+ - name : Set up regions matrix
83+ id : set-matrix
84+ run : |
85+ IFS=',' read -ra REGIONS <<< "${{ github.event.inputs.aws_region }}"
86+ MATRIX="["
87+ for region in "${REGIONS[@]}"; do
88+ trimmed_region=$(echo "$region" | xargs)
89+ MATRIX+="\"$trimmed_region\","
90+ done
91+ MATRIX="${MATRIX%,}]"
92+ echo ${MATRIX}
93+ echo "aws_regions_json=${MATRIX}" >> $GITHUB_OUTPUT
94+ - name : Checkout Repo @ SHA - ${{ github.sha }}
95+ uses : actions/checkout@v4
96+ - name : Setup Node
97+ uses : actions/setup-node@v4
98+ with :
99+ node-version : 22
100+ - name : NPM Clean Install
101+ # https://docs.npmjs.com/cli/v10/commands/npm-ci
102+ run : npm ci
103+ - name : Compile all NPM projects
104+ run : npm run compile
105+ - name : Build Lambda Layer
106+ run : npm run build-lambda
107+ - name : upload layer
108+ uses : actions/upload-artifact@v4
109+ with :
110+ name : layer.zip
111+ path : lambda-layer/packages/layer/build/layer.zip
112+
113+ publish :
114+ needs : [build, build-layer]
115+ runs-on : ubuntu-latest
116+ steps :
117+ - name : Checkout Repo @ SHA - ${{ github.sha }}
118+ uses : actions/checkout@v4
69119
70120 - name : Configure AWS credentials for private ECR
71121 uses : aws-actions/configure-aws-credentials@v4
89139 with :
90140 registry : public.ecr.aws
91141
92-
93142 # Publish to public ECR
94143 - name : Build and push public ECR image
95144 uses : docker/build-push-action@v5
@@ -112,93 +161,17 @@ jobs:
112161 tags : |
113162 ${{ env.RELEASE_PRIVATE_REPOSITORY }}:v${{ github.event.inputs.version }}
114163
115- - name : Get SHA256 checksum of release artifact
116- id : get_sha256
117- run : |
118- shasum -a 256 aws-distro-opentelemetry-node-autoinstrumentation/${{ env.ARTIFACT_NAME }} | sed "s|aws-distro-opentelemetry-node-autoinstrumentation/||" > ${{ env.ARTIFACT_NAME }}.sha256
119-
120- # Publish to GitHub releases
121- - name : Create GH release
122- id : create_release
123- env :
124- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
125- run : |
126- # Generate dependency versions from package.json
127- DEPS=$(node -e "
128- const pkg = require('./aws-distro-opentelemetry-node-autoinstrumentation/package.json');
129- const deps = Object.entries(pkg.dependencies || {})
130- .map(([name, version]) => \`- \\\`\${name}\\\` - \${version}\`)
131- .join('\n');
132- console.log(deps);
133- ")
134-
135- # Create release notes
136- cat > release_notes.md << EOF
137- This release contains the following upstream components:
138-
139- $DEPS
140-
141- This release also publishes to public ECR and NPM.
142- * See ADOT node auto-instrumentation Docker image v${{ github.event.inputs.version }} in our public ECR repository:
143- https://gallery.ecr.aws/aws-observability/adot-autoinstrumentation-node
144- * See version ${{ github.event.inputs.version }} in our NPM repository:
145- https://www.npmjs.com/package/@aws/aws-distro-opentelemetry-node-autoinstrumentation
146- EOF
147-
148- gh release create --target "$GITHUB_REF_NAME" \
149- --title "Release v${{ github.event.inputs.version }}" \
150- --notes-file release_notes.md \
151- --draft \
152- "v${{ github.event.inputs.version }}" \
153- aws-distro-opentelemetry-node-autoinstrumentation/${{ env.ARTIFACT_NAME }} \
154- ${{ env.ARTIFACT_NAME }}.sha256
155-
156164 # Publish '@aws/aws-distro-opentelemetry-node-autoinstrumentation' to npm
157165 - name : Publish autoinstrumentation to npm
158166 working-directory : aws-distro-opentelemetry-node-autoinstrumentation
159167 env :
160168 NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
161169 NPM_CONFIG_PROVENANCE : true
162170 run : npm publish
163- build-layer :
164- needs : build
165- runs-on : ubuntu-latest
166- outputs :
167- aws_regions_json : ${{ steps.set-matrix.outputs.aws_regions_json }}
168- steps :
169- - name : Set up regions matrix
170- id : set-matrix
171- run : |
172- IFS=',' read -ra REGIONS <<< "${{ github.event.inputs.aws_region }}"
173- MATRIX="["
174- for region in "${REGIONS[@]}"; do
175- trimmed_region=$(echo "$region" | xargs)
176- MATRIX+="\"$trimmed_region\","
177- done
178- MATRIX="${MATRIX%,}]"
179- echo ${MATRIX}
180- echo "aws_regions_json=${MATRIX}" >> $GITHUB_OUTPUT
181- - name : Checkout Repo @ SHA - ${{ github.sha }}
182- uses : actions/checkout@v4
183- - name : Setup Node
184- uses : actions/setup-node@v4
185- with :
186- node-version : 22
187- - name : NPM Clean Install
188- # https://docs.npmjs.com/cli/v10/commands/npm-ci
189- run : npm ci
190- - name : Compile all NPM projects
191- run : npm run compile
192- - name : Build Lambda Layer
193- run : npm run build-lambda
194- - name : upload layer
195- uses : actions/upload-artifact@v4
196- with :
197- name : layer.zip
198- path : lambda-layer/packages/layer/build/layer.zip
171+
199172 publish-layer-prod :
200173 runs-on : ubuntu-latest
201- needs : build-layer
174+ needs : [ build-layer, publish]
202175 strategy :
203176 matrix :
204177 aws_region : ${{ fromJson(needs.build-layer.outputs.aws_regions_json) }}
@@ -279,9 +252,12 @@ jobs:
279252 if : always()
280253 run : |
281254 aws s3 rb --force s3://${{ env.BUCKET_NAME }}
255+
282256 generate-lambda-release-note :
283257 runs-on : ubuntu-latest
284- needs : publish-layer-prod
258+ needs : [publish, publish-layer-prod]
259+ outputs :
260+ layer-note : ${{ steps.layer-note.outputs.layer-note }}
285261 steps :
286262 - name : Checkout Repo @ SHA - ${{ github.sha }}
287263 uses : actions/checkout@v4
@@ -300,6 +276,7 @@ jobs:
300276 cat $file
301277 done
302278 - name : generate layer-note
279+ id : layer-note
303280 working-directory : ${{ env.LAYER_NAME }}
304281 run : |
305282 echo "| Region | Layer ARN |" >> ../layer-note
@@ -310,6 +287,11 @@ jobs:
310287 echo "| " $file " | " $arn " |" >> ../layer-note
311288 done
312289 cd ..
290+ {
291+ echo "layer-note<<EOF"
292+ cat layer-note
293+ echo "EOF"
294+ } >> $GITHUB_OUTPUT
313295 cat layer-note
314296 - name : generate tf layer
315297 working-directory : ${{ env.LAYER_NAME }}
@@ -336,44 +318,66 @@ jobs:
336318 done
337319 echo "}" >> ../layer_cdk
338320 cat ../layer_cdk
339- - name : download layer.zip
321+
322+ publish-github :
323+ needs : generate-lambda-release-note
324+ runs-on : ubuntu-latest
325+ steps :
326+ - name : Checkout Repo @ SHA - ${{ github.sha }}
327+ uses : actions/checkout@v4
328+
329+ - name : Download SDK artifact
330+ uses : actions/download-artifact@v4
331+ with :
332+ name : ${{ env.ARTIFACT_NAME }}
333+
334+ - name : Download layer.zip artifact
340335 uses : actions/download-artifact@v4
341336 with :
342337 name : layer.zip
343- - name : Get commit hash
344- id : commit
345- run : |
346- echo "sha_short=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_OUTPUT
347- - name : Update GH release
338+
339+ # Publish to GitHub releases
340+ - name : Create GH release
341+ id : create_release
348342 env :
349343 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
350344 run : |
351- TAG="v${{ github.event.inputs.version }}"
352- # Generate SHA-256 checksum for layer.zip
345+ # Generate dependency versions from package.json
346+ DEPS=$(node -e "
347+ const pkg = require('./aws-distro-opentelemetry-node-autoinstrumentation/package.json');
348+ const deps = Object.entries(pkg.dependencies || {})
349+ .map(([name, version]) => \`- \\\`\${name}\\\` - \${version}\`)
350+ .join('\n');
351+ console.log(deps);
352+ ")
353+
354+ # Create release notes
355+ cat > release_notes.md << EOF
356+ This release contains the following upstream components:
357+
358+ $DEPS
359+
360+ This release also publishes to public ECR and NPM.
361+ * See ADOT node auto-instrumentation Docker image v${{ github.event.inputs.version }} in our public ECR repository:
362+ https://gallery.ecr.aws/aws-observability/adot-autoinstrumentation-node
363+ * See version ${{ github.event.inputs.version }} in our NPM repository:
364+ https://www.npmjs.com/package/@aws/aws-distro-opentelemetry-node-autoinstrumentation
365+
366+ This release also includes the AWS OpenTelemetry Lambda Layer for JavaScript version ${{ github.event.inputs.version }}-$(echo $GITHUB_SHA | cut -c1-7).
367+
368+ Lambda Layer ARNs:
369+ ${{ needs.generate-lambda-release-note.outputs.layer-note }}
370+ EOF
371+
372+ shasum -a 256 ${{ env.ARTIFACT_NAME }} > ${{ env.ARTIFACT_NAME }}.sha256
353373 shasum -a 256 layer.zip > layer.zip.sha256
354- gh release upload $TAG \
355- layer.zip \
356- layer.zip.sha256 \
357- layer_arns.tf \
358- --clobber
359- - name : Update Release Notes
360- env :
361- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
362- run : |
363- TAG="v${{ github.event.inputs.version }}"
364- # Get current release notes
365- current_notes=$(gh release view $TAG --json body -q .body)
366- echo "This release also includes the AWS OpenTelemetry Lambda Layer for JavaScript version ${{ github.event.inputs.version }}-${{ steps.commit.outputs.sha_short }}." >> lambda_notes.md
367- echo "" >> lambda_notes.md
368- echo "Lambda Layer ARNs:" >> lambda_notes.md
369- echo "" >> lambda_notes.md
370- cat layer-note >> lambda_notes.md
371- echo "" >> lambda_notes.md
372- echo "Notes:" >> lambda_notes.md
373- {
374- echo "$current_notes"
375- echo ""
376- cat lambda_notes.md
377- } > updated_notes.md
378- # Update release notes
379- gh release edit $TAG --notes-file updated_notes.md
374+
375+ gh release create --target "$GITHUB_REF_NAME" \
376+ --title "Release v${{ github.event.inputs.version }}" \
377+ --notes-file release_notes.md \
378+ --draft \
379+ "v${{ github.event.inputs.version }}" \
380+ ${{ env.ARTIFACT_NAME }} \
381+ ${{ env.ARTIFACT_NAME }}.sha256 \
382+ layer.zip \
383+ layer.zip.sha256
0 commit comments