Skip to content

Only on push

Only on push #16

Workflow file for this run

name: Build, Test, Package and ZIP .NET 6 Lambda Functions
on: [push]
jobs:
build:
runs-on: ubuntu-latest
env:
ProjectBasePath: 'LolChest.Lambda'
strategy:
matrix:
project: ['DailyReport', 'MonthlyReport', 'YearlyReport', 'Update']
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Restore Dependencies
run: dotnet restore $ProjectBasePath.${{ matrix.project }}
- name: Build
run: dotnet build --configuration Release --no-restore $ProjectBasePath.${{ matrix.project }}
- name: Test
run: dotnet test --no-restore --verbosity normal $ProjectBasePath.${{ matrix.project }}
- name: Publish
run: dotnet publish --configuration Release --no-build --output ./publish $ProjectBasePath.${{ matrix.project }}
- name: Create ZIP
run: |
cd ./publish
zip -r ../${{ matrix.project }}.zip *
- name: Upload ZIP
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.project }}
path: ./${{ matrix.project }}.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: eu-central-1
- name: Deploy to AWS Lambda
run: |
aws lambda update-function-code --function-name ${{ matrix.project }} --zip-file fileb://${{ matrix.project }}.zip