Skip to content

Commit

Permalink
chore: Update golang.yml workflow to copy golang-build-deploy.sh from…
Browse files Browse the repository at this point in the history
… the correct directory
  • Loading branch information
tanjilbhuiyan committed May 16, 2024
1 parent 4ea38c8 commit f0c71c9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
12 changes: 6 additions & 6 deletions .github/scripts/golang-build-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ while read line; do
printf '%s\n' "$directory_path"

# Extract the path without the filename and the initial 'lambda/' part
zip_name=$(dirname "$directory_path" | sed 's|^lambda/||')
file_path=$(dirname "$directory_path" | sed 's|^lambda/||')

# Determine if the last segment is 'src' or not
last_segment=$(basename "$zip_name")
last_segment=$(basename "$file_path")

if [ "$last_segment" = "src" ]; then
# Remove the last segment if it is 'src'
zip_name =$(dirname "$zip_name")
file_path =$(dirname "$file_path")
fi

# Replace '/' with '_'
result=$(echo "$zip_name" | tr '/' '_')
zip_name=$(echo "$file_path" | tr '/' '_')

printf '%s\n' "$result"

Expand All @@ -52,12 +52,12 @@ while read line; do
echo "Build in directory $directory_path succeeded:"
echo "$build_output"
# Zip the bootstrap file
zip -q "$result.zip" bootstrap
zip -q "$zip_name.zip" bootstrap
ls -la
pwd
echo "Bootstrap file zipped as bootstrap.zip"
echo "Uploading to AWS S3"
aws s3 cp "$result.zip" "s3://$S3_BUCKET_NAME/$result.zip"
aws s3 cp "$zip_name.zip" "s3://$S3_BUCKET_NAME/$zip_name.zip"

else
echo "Build in directory $directory_path failed:"
Expand Down
2 changes: 1 addition & 1 deletion lambda/github-lambda-test-1/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ func handler(ctx context.Context) (string, error) {

func main() {
lambda.Start(handler)
}
}
2 changes: 1 addition & 1 deletion lambda/github-lambda-test-2/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ func handler(ctx context.Context) (string, error) {

func main() {
lambda.Start(handler)
}
}
2 changes: 1 addition & 1 deletion lambda/payments/gateways/stripe/confirm/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ func handler(ctx context.Context) (string, error) {

func main() {
lambda.Start(handler)
}
}
6 changes: 6 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ module "golang-lambda-2" {
s3_bucket = module.golang-lambda-bucket.s3-bucket-function_name

}
module "payments_gateways_stripe_confirm" {
source = "./lambda/payments/gateways/stripe/confirm"
s3_bucket = module.golang-lambda-bucket.s3-bucket-function_name

}


# Define module for golang-lambda-bucket
module "golang-lambda-bucket" {
Expand Down

0 comments on commit f0c71c9

Please sign in to comment.