Skip to content

Commit

Permalink
changes for api
Browse files Browse the repository at this point in the history
  • Loading branch information
Purshotam patidar committed Jun 21, 2024
1 parent 05ecc8e commit 63f67fc
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 46 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ on:
workflow_call:

jobs:
build_api:
# The type of runner that the job will run on
runs-on: ubuntu-latest
timeout-minutes: 80
environment: Production
permissions:
contents: read
packages: write
deployments: write
# build_api:
# # The type of runner that the job will run on
# runs-on: ubuntu-latest
# timeout-minutes: 80
# environment: Production
# permissions:
# contents: read
# packages: write
# deployments: write
steps:
- name: Build, tag, and push image to Github Container Registry
id: build-image
Expand Down
102 changes: 67 additions & 35 deletions .github/workflows/deploy-quality.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,76 @@
name: Deploy with Docker Compose
name: Deploy Impler to Quality

on:
push:
branches:
- next

jobs:
deploy:
runs-on: ubuntu-latest
setup_project:
uses: ./.github/workflows/reusable-setup.yml

build_api:
needs:
- setup_project
# if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/api/') }}
uses: ./.github/workflows/build-api.yml

build_embed:
needs:
- setup_project
permissions:
contents: read
packages: write
deployments: write
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/demo/') }}
uses: ./.github/workflows/build-embed.yml

build_queuemanager:
needs:
- setup_project
permissions:
contents: read
packages: write
deployments: write
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/queue-manager/') }}
uses: ./.github/workflows/build-queuemanager.yml

build_web:
needs:
- setup_project
permissions:
contents: read
packages: write
deployments: write
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/web/') }}
uses: ./.github/workflows/build-web.yml

build_widget:
needs:
- setup_project
permissions:
contents: read
packages: write
deployments: write
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/widget/') }}
uses: ./.github/workflows/build-widget.yml

deploy_with_ssh:
runs-on: ubuntu-latest
needs:
- setup_project
- build_api
- build_embed
- build_queuemanager
- build_web
- build_widget
# if: needs.setup_project.outputs.success == 'true' || needs.build_api.outputs.success == 'true' || needs.build_embed.outputs.success == 'true' || needs.build_queuemanager.outputs.success == 'true' || needs.build_web.outputs.success == 'true' || needs.build_widget.outputs.success == 'true'
steps:
- name: Setup Project
uses: ./.github/workflows/reusable-setup.yml

- name: Build API
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/api/') }}
uses: ./.github/workflows/build-api.yml

- name: Build Embed
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/embed/') }}
uses: ./.github/workflows/build-embed.yml

- name: Build Queue Manager
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/queuemanager/') }}
uses: ./.github/workflows/build-queuemanager.yml

- name: Build Web
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/web/') }}
uses: ./.github/workflows/build-web.yml

- name: Build Widget
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/widget/') }}
uses: ./.github/workflows/build-widget.yml

- name: Setup SSH
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Run Docker Compose Up
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} \
"cd /home/impler/impler-quality && docker-compose up -d"
- name: Set up SSH and Run Docker Compose Up
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_QA }}
- name: Run Docker Compose Up
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USERNAME_QA }}@${{ secrets.SSH_HOST_QA }} \
"cd ${{ secrets.SSH_PATH_QA }} && docker compose up -d"
3 changes: 1 addition & 2 deletions .github/workflows/reusable-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ jobs:
setup_project:
# The type of runner that the job will run on
runs-on: ubuntu-latest
timeout-minutes: 80
environment: Production
permissions:
contents: read
packages: write
deployments: write
timeout-minutes: 80
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
Expand Down

0 comments on commit 63f67fc

Please sign in to comment.