From ba248c0c810555896035659c3501e10e7ef69116 Mon Sep 17 00:00:00 2001 From: RobKraft Date: Wed, 11 Dec 2024 19:14:45 -0600 Subject: [PATCH] Create deployLambdaGetOrgItems.yml --- .github/workflows/deployLambdaGetOrgItems.yml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/deployLambdaGetOrgItems.yml diff --git a/.github/workflows/deployLambdaGetOrgItems.yml b/.github/workflows/deployLambdaGetOrgItems.yml new file mode 100644 index 0000000..dbf5c04 --- /dev/null +++ b/.github/workflows/deployLambdaGetOrgItems.yml @@ -0,0 +1,50 @@ +name: GetOrgItems Build/Deploy Lambda + +on: + push: + paths: + - 'Lambdas/GetOrgItems/**' + pull_request: + paths: + - 'Lambdas/GetOrgItems/**' + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' # Specify your .NET Core version + + - name: Restore dependencies + run: | + cd Lambdas/GetOrgItems + dotnet restore GetOrgItems.csproj + + - name: Build + run: dotnet build Lambdas/GetOrgItems/GetOrgItems.csproj --configuration Release --no-restore + + - name: Publish + run: dotnet publish Lambdas/GetOrgItems/GetOrgItems.csproj -c Release -o ./publish /p:PublishReadyToRun=true /p:PublishTrimmed=true + + - name: Package Lambda + run: | + cd publish + zip -r ../lambda-package.zip . + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-2 # Replace with your AWS region + + - name: Deploy to AWS Lambda + run: | + aws lambda update-function-code --function-name arn:aws:lambda:us-east-2:537766411402:function:GetOrgItems --zip-file fileb://lambda-package.zip + env: + AWS_DEFAULT_REGION: us-east-2 # Replace with your AWS region