Skip to content

Commit

Permalink
ci: fix ci deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic-maury committed Apr 27, 2024
1 parent 284bdeb commit 99bf9d9
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/main-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,16 @@ jobs:
key: ${{ secrets.SSH_KEY }}
script: |
docker pull ${{ secrets.REPOSITORY }}:backend-latest
restart-backend:
needs: deploy-backend
runs-on: ubuntu-latest
steps:
- name: Execute commands over SSH
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
docker service update ${{ secrets.REPOSITORY }}_backend --force
13 changes: 13 additions & 0 deletions .github/workflows/main-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,17 @@ jobs:
key: ${{ secrets.SSH_KEY }}
script: |
docker pull ${{ secrets.REPOSITORY }}:frontend-latest
restart-frontend:
needs: deploy-frontend
runs-on: ubuntu-latest
steps:
- name: Execute commands over SSH
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
debug: true
script: |
docker service update ${{ secrets.REPOSITORY }}_frontend --force
29 changes: 29 additions & 0 deletions .github/workflows/restart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Restart service
on:
workflow_dispatch:
inputs:
service:
description: 'Service to restart: frontend, backend, or both'
required: true
default: 'both'
validation:
pattern: '^(frontend|backend|both)$'

jobs:
restart:
runs-on: ubuntu-latest
steps:
- name: Execute commands over SSH
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
debug: true
script: |
if [ "${{ github.event.inputs.service }}" = "frontend" ] || [ "${{ github.event.inputs.service }}" = "both" ]; then
docker service update ${{ secrets.REPOSITORY }}_frontend --force
fi
if [ "${{ github.event.inputs.service }}" = "backend" ] || [ "${{ github.event.inputs.service }}" = "both" ]; then
docker service update ${{ secrets.REPOSITORY }}_backend --force
fi

0 comments on commit 99bf9d9

Please sign in to comment.