File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4444 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4545 shell : bash
46- run : ./scripts/create-release.sh true
46+ run : ./scripts/create-release.sh
4747
4848 - name : Build
4949 if : steps.create-release.outputs.released == 'true'
5555 env :
5656 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5757 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
58- run : ./scripts/publish.sh "${{ steps.create-release.outputs.tag }}"
58+ run : ./scripts/publish.sh "${{ steps.create-release.outputs.tag }}" "${{ steps.build.outputs.sha256 }}"
Original file line number Diff line number Diff line change @@ -88,17 +88,26 @@ function sha256_hash() {
8888 fi
8989}
9090
91+ function write_gha_outputs() {
92+ echo " size=$1 " >> " $GITHUB_OUTPUT "
93+ echo " sha256=$2 " >> " $GITHUB_OUTPUT "
94+ }
95+
9196function main() {
9297 cleanup
9398 build
9499 verify_build
95100
96101 zip_size=$( ls -lh dist/lambda.zip | awk ' {print $5}' )
97- zip_hash =$( sha256_hash)
102+ zip_sha256 =$( sha256_hash)
98103 echo " Lambda deployment package built"
99104 echo " path=${DIST_PATH} "
100105 echo " size=${zip_size} "
101- echo " hash=${zip_hash} "
106+ echo " sha256=${zip_sha256} "
107+
108+ if [ -n " $GITHUB_OUTPUT " ]; then
109+ write_gha_outputs " $zip_size " " $zip_sha256 "
110+ fi
102111}
103112
104113main
Original file line number Diff line number Diff line change 77# - Create a GitHub release with semantic-release.
88# - Output the release tag and whether a release was created.
99
10- PUSH_TAG=" ${1:- false} "
1110INITIAL_VERSION_TAG=" v0.0.0"
1211
1312# Only configure Git identity in CI environment
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- dist_path=" dist"
43tag=" ${1} "
4+ sha256=" ${2} "
5+ dist_path=" dist"
56
67if [ -z " $tag " ] || [ " $tag " = " none" ]; then
78 echo " Valid tag is required (got: '$tag ')"
89 exit 1
9- fi
10-
11- echo " Publishing distribution artifacts to GitHub Release $tag "
12-
13- # Ensure distribution artifacts exist. Add more files if you have them.
14- if [ ! -d " $dist_path " ]; then
10+ elif [ -z " $sha256 " ] || [ " $sha256 " = " none" ]; then
11+ echo " Valid SHA256 hash is required (got: '$sha256 ')"
12+ exit 1
13+ elif [ ! -d " $dist_path " ]; then
1514 echo " Distribution directory $dist_path does not exist"
1615 exit 1
1716fi
1817
19- ls -lah " $dist_path "
18+ function publish_github_release() {
19+ # Upload distribution artifacts to GitHub Release (idempotent if re-run).
20+ echo " Publishing distribution artifacts to GitHub Release $tag "
21+ gh release upload " $tag " " $dist_path /*" --clobber
22+ }
23+
24+ function publish_s3_object() {
25+ bucket_path=" lambda/lambda-application/$tag /$sha256 /lambda.zip"
26+ echo " Publishing distribution artifacts to S3 bucket $bucket_path "
27+ }
28+
29+ function main() {
30+ ls -lah " $dist_path "
31+
32+ publish_github_release
33+ }
2034
21- # Upload distribution artifacts to GitHub Release (idempotent if re-run).
22- gh release upload " $tag " " $dist_path /*" --clobber
35+ main
You can’t perform that action at this time.
0 commit comments