Skip to content

Commit

Permalink
fix scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyek committed Apr 1, 2024
1 parent c02c529 commit 927fadc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
ecr_repository_scrape_txs_url
iam_lambda_role_arn
deploy-scrape-txs:
name: Deploy Scrape Bank Transactions
name: Deploy Scrape Bank Transactions function
runs-on: ubuntu-22.04
needs: terraform
defaults:
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
cd ./deploy
serverless deploy
deploy-update-ynab:
name: Deoloy Update YNAB
name: Deploy Update YNAB function
runs-on: ubuntu-22.04
needs: terraform
defaults:
Expand Down
1 change: 1 addition & 0 deletions projects/update-ynab/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bootstrap
update-ynab.zip
16 changes: 1 addition & 15 deletions projects/update-ynab/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,4 @@ build: # https://docs.aws.amazon.com/lambda/latest/dg/golang-package.html
GOOS=linux GOARCH=arm64 go build -tags lambda.norpc -o bootstrap main.go
zip ${zipfile} bootstrap
deploy:
function_name="update-ynab-fn"
if aws lambda get-function --function-name $function_name --region us-east-1 &> /dev/null
then
$(info Updating function)
aws lambda update-function-code --function-name $function_name \
--zip-file fileb://${zipfile}
else
$(info Creating function)
aws lambda create-function --function-name $function_name \
--runtime provided.al2023 \
--handler bootstrap \
--architectures arm64 \
--role $LAMBDA_ROLE_ARN \
--zip-file fileb://${zipfile}
fi
ZIPFILE=${zipfile} ./scripts/deploy.sh
17 changes: 17 additions & 0 deletions projects/update-ynab/scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

function_name="update-ynab-fn"

if aws lambda get-function --function-name $function_name --region us-east-1 &> /dev/null; then
echo "Updating function"
aws lambda update-function-code --function-name $function_name \
--zip-file fileb://$ZIPFILE
else
echo "Creating function"
aws lambda create-function --function-name $function_name \
--runtime provided.al2023 \
--handler bootstrap \
--architectures arm64 \
--role $LAMBDA_ROLE_ARN \
--zip-file fileb://$ZIPFILE
fi

0 comments on commit 927fadc

Please sign in to comment.