-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (69 loc) · 2.25 KB
/
deply_dev_project.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Deploy Development App
on:
workflow_call:
push:
branches:
- develop-aws
- feature/Implementação-Workflow-to-Deploy-App-in-AWS
permissions:
contents: read
jobs:
build_and_test_net:
name: Build and Test .Net App
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache .NET packages
uses: actions/cache@v3
id: dotnet-cache
with:
path: ~/.nuget/packages
key: dotnet-packages-${{ github.repository }}
restore-keys: dotnet-packages-${{ github.repository }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
if: steps.dotnet-cache.outputs.cache-hit != 'true'
with:
dotnet-version: 7.0.x
- name: Build and Restore App
run: dotnet build ./HomeBrokerSPA/HomeBrokerSPA.csproj --restore
continue-on-error: false
trigger_build_and_test:
name: Build and Test
uses: alexfariakof/Home_Broker_Chart/.github/workflows/build_and_test.yml@main
secrets: inherit
deploy:
needs: build_and_test_net
name: Publish App in AWS
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build Docker image
env:
DOCKER_CLI_AGGREGATE: 1
run: |
docker-compose -f docker-compose.dev.yml build
continue-on-error: false
- name: Push Docker image to Docker Hub
env:
DOCKER_LOGIN: ${{ secrets.DOCKER_LOGIN }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_CLI_AGGREGATE: 1
run: |
docker login -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWORD }}
docker push alexfariakof/homebrokerspa-dev-img
continue-on-error: false
- name: Execute SSH Commands into EC2
env:
EC2_HOST: ${{ secrets.EC2_HOST }}
EC2_USERNAME: ${{ secrets.EC2_USERNAME }}
AWS_SSH_KEY: ${{ secrets.AWS_SSH_KEY }}
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.AWS_SSH_KEY }}
port: 22
script: |
./scripts/hb-spa.dev.sh