-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (49 loc) · 2.07 KB
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Deploy on AWS Beanstalk
on:
push:
branches: [ "prod", "trunk" ]
pull_request:
branches: [ "prod", "trunk" ]
env:
PROJECT_LOCATION: src/Blazing.csproj
ELASTIC_BEANSTALK_NAME: Blazing
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore $PROJECT_LOCATION
- name: Build
run: dotnet build --no-restore $PROJECT_LOCATION
- name: Pack
run: |
dotnet publish $PROJECT_LOCATION -c Release --output "${{ github.workspace }}/${{ github.run_id }}"
cd ${{ github.run_id }}
zip -r ../${{ github.run_id }}.zip .
- name: Upload Artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: deploy-files
path: ${{ github.run_id }}.zip
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v4.1.7
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-southeast-2
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Deploy
run: |
aws s3 cp "deploy-files/${{ github.run_id }}.zip" s3://elasticbeanstalk-ap-southeast-2-${{ secrets.AWS_ACCOUNT_ID }}/artifact/blazing-blazor-app/
aws elasticbeanstalk create-application-version --application-name $ELASTIC_BEANSTALK_NAME --version-label ${{ github.run_id }} --description ${{ github.run_id }} --source-bundle S3Bucket="elasticbeanstalk-ap-southeast-2-${{ secrets.AWS_ACCOUNT_ID }}",S3Key="artifact/blazing-blazor-app/${{ github.run_id }}.zip"
aws elasticbeanstalk update-environment --application-name $ELASTIC_BEANSTALK_NAME --environment-name ${{ secrets.AWS_BEANSTALK_ENV }} --version-label ${{ github.run_id }}
aws elasticbeanstalk wait environment-updated --application-name $ELASTIC_BEANSTALK_NAME --environment-name ${{ secrets.AWS_BEANSTALK_ENV }}