Merging changes from dev to staging #84
This file contains 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: Continuous Integration/ Continuous Deployment | |
on: | |
pull_request_target: | |
types: | |
- closed | |
branches: [staging] | |
jobs: | |
if_merged: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Docker Login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{secrets.DOCKER_USER}} | |
password: ${{secrets.DOCKER_PASSWORD}} | |
- name: adding api_end_point credentials | |
run: sed -i 's|api_end_point|${{secrets.QA_API_END_POINT}}|g' src/environments/environment.prod.ts | |
shell: bash | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: tibildocker/dashboard_ms:qa | |
- name: Docker pull image and deploy from hub | |
env: | |
DOCKER_USER: ${{secrets.DOCKER_USER}} | |
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} | |
uses: appleboy/ssh-action@master | |
with: | |
HOST: ${{ secrets.QA_HOST }} | |
USERNAME: ${{ secrets.USERNAME }} | |
KEY: ${{ secrets.KEY }} | |
PORT: '22' | |
script: | | |
docker login | |
docker pull tibildocker/dashboard_ms | |
docker stop ansible_dashboard_app_1 || true | |
docker rm ansible_dashboard_app_1 || true | |
docker rmi tibildocker/dashboard_ms:qa || true | |
docker run -d --name ansible_dashboard_app_1 -p 4200:80 --network ansible_cqube_net tibildocker/dashboard_ms:qa |