Skip to content

Commit 603e878

Browse files
wangzleimxiamxia
andauthored
Create tag and release for releasing Lambda layer (#93)
*Description of changes:* When releasing lambda layer: * Create tag from commit id * Create github release with layer arns in release note By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. Co-authored-by: Min Xia <[email protected]>
1 parent 445031b commit 603e878

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

.github/workflows/release-lambda.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,6 @@ jobs:
186186
with:
187187
name: layer.tf
188188
path: layer.tf
189-
update-layer:
190-
runs-on: ubuntu-latest
191-
needs: generate-release-note
192-
steps:
193-
- name: Checkout Repo @ SHA - ${{ github.sha }}
194-
uses: actions/checkout@v4
195-
- name: download layer.tf
196-
uses: actions/download-artifact@v3
197-
with:
198-
name: layer.tf
199189
- name: Commit changes
200190
env:
201191
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -206,3 +196,35 @@ jobs:
206196
git add lambda-layer/terraform/lambda/layer.tf
207197
git commit -m "Update Lambda layer ARNs for releasing" || echo "No changes to commit"
208198
git push
199+
create-release:
200+
runs-on: ubuntu-latest
201+
needs: generate-release-note
202+
steps:
203+
- name: Checkout Repo @ SHA - ${{ github.sha }}
204+
uses: actions/checkout@v4
205+
- name: Get latest commit SHA
206+
run: |
207+
echo "COMMIT_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
208+
SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7)
209+
echo "SHORT_SHA=${SHORT_SHA}" >> $GITHUB_ENV
210+
- name: Create Tag
211+
run: |
212+
git config user.name "github-actions[bot]"
213+
git config user.email "github-actions[bot]@users.noreply.github.com"
214+
TAG_NAME="lambda-${SHORT_SHA}"
215+
git tag -a "$TAG_NAME" -m "Release Lambda layer based on commit $TAG_NAME"
216+
git push origin "$TAG_NAME"
217+
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
218+
env:
219+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
220+
- name: Create Release
221+
id: create_release
222+
uses: actions/create-release@v1
223+
env:
224+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
225+
with:
226+
tag_name: ${{ env.TAG_NAME }}
227+
release_name: "Release AWSOpenTelemetryDistroPython Lambda Layer"
228+
body_path: lambda-layer/terraform/lambda/layer.tf
229+
draft: true
230+
prerelease: false

0 commit comments

Comments
 (0)