-
Notifications
You must be signed in to change notification settings - Fork 10
45 lines (45 loc) · 1.81 KB
/
build_and_deploy.yml
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
name: Trapdoor AWS SAR Deployment
on:
push:
branches: [ master ]
tags:
- '*.*.*'
pull_request:
branches: [ master ]
tags:
- '*.*.*'
jobs:
build:
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
- name: dependencies
run: dotnet restore
- name: Build API
run: |
dotnet build Trapdoor.csproj --configuration Production
dotnet publish Trapdoor.csproj -o ./staging/app /p:EnvironmentName=Production
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: zip and upload
run: |
cd ./staging/app
zip -r trapdoor.zip .
- name: Upload artifact zip file and SAM template
run: |
aws s3 cp ./staging/app/trapdoor.zip s3://3cs-serverless-apps/trapdoor/ --content-type=application/zip
aws s3 cp sar.template s3://3cs-serverless-apps/trapdoor/
- name: Create new version in AWS SAR
run: |
temp=${{github.ref}}
temp=$(sed 's|refs/tags/||' <<< $temp)
aws serverlessrepo create-application-version --application-id "arn:aws:serverlessrepo:eu-central-1:756157594214:applications/Trapdoor" --semantic-version $temp --source-code-archive-url "https://3cs-serverless-apps.s3.eu-central-1.amazonaws.com/trapdoor/trapdoor.zip" --source-code-url "https://github.com/3CORESec/Trapdoor" --template-url "https://3cs-serverless-apps.s3.eu-central-1.amazonaws.com/trapdoor/sar.template"