Update GitHub Actions workflow #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy .NET Backend to AWS | |
on: | |
push: | |
branches: [ "prod" ] | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: dotnetBackend | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore --configuration Release | |
- name: Publish | |
run: dotnet publish -c Release -o ./publish | |
- name: Zip publish folder | |
run: zip -r publish.zip ./ | |
working-directory: ./publish | |
- name: Move zip to dotnetBackend | |
run: mv publish.zip ../ | |
working-directory: ./publish | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-3 | |
- name: Deploy to AWS Elastic Beanstalk | |
uses: einaregilsson/beanstalk-deploy@v21 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
application_name: LibreScriptBackend | |
environment_name: LibreScriptBackend-env | |
region: eu-west-3 | |
version_label: ${{ github.sha }} | |
deployment_package: publish.zip |