diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index ce6cc86..f7356cf 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -75,6 +75,6 @@ jobs: trigger_tests_sonarcloud: needs: build_and_test_angular - name: Test and Analysis Code In Sonar Cloud + name: Triggered Build and Test uses: alexfariakof/Home_Broker_Chart/.github/workflows/test_analyse_in_Sonar_Cloud.yml@main secrets: inherit diff --git a/.github/workflows/deply_dev_project.yml b/.github/workflows/deply_dev_project.yml new file mode 100644 index 0000000..2821773 --- /dev/null +++ b/.github/workflows/deply_dev_project.yml @@ -0,0 +1,54 @@ +name: Deploy Development App +on: + push: + branches: + - staging + +permissions: + contents: read + +jobs: + trigger_build_and_test: + name: Triggered Deploy Dev + uses: alexfariakof/Home_Broker_Chart/.github/workflows/build_and_test.yml@main + secrets: inherit + + deploy: + needs: trigger_build_and_test + 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 + diff --git a/.github/workflows/deply_prod_project.yml b/.github/workflows/deply_prod_project.yml new file mode 100644 index 0000000..c417d11 --- /dev/null +++ b/.github/workflows/deply_prod_project.yml @@ -0,0 +1,54 @@ +name: Deploy Production App +on: + push: + tags: + - v*.*.* + +permissions: + contents: read + +jobs: + trigger_build_and_test: + name: Triggered Deploy Prod + uses: alexfariakof/Home_Broker_Chart/.github/workflows/build_and_test.yml@main + secrets: inherit + + deploy: + needs: trigger_build_and_test + 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.prod.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-prod-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.prod.sh +