refactor: updated image remote pattern config #18
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: CI/CD Deploy Pipeline # The name of the workflow | |
on: | |
pull_request: | |
types: | |
- closed | |
workflow_dispatch: | |
jobs: | |
deploy: | |
name: "Publish Application" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Run deploy on SSH" | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'deployment' | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
port: ${{ secrets.SERVER_PORT }} | |
script: | | |
cd app | |
echo ${{ secrets.REGISTRY_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin | |
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'backend') }}" == "true" ]]; then | |
docker rm $(docker stop $(docker ps -a -q --filter ancestor=ghcr.io/dmytro-komlyk/prod-fixlab-server:latest )) | |
docker rmi ghcr.io/dmytro-komlyk/prod-fixlab-server:latest | |
fi | |
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'frontend-client') }}" == "true" ]]; then | |
docker rm $(docker stop $(docker ps -a -q --filter ancestor=ghcr.io/dmytro-komlyk/prod-fixlab-client:latest )) | |
docker rmi ghcr.io/dmytro-komlyk/prod-fixlab-client:latest | |
fi | |
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'frontend-admin') }}" == "true" ]]; then | |
docker rm $(docker stop $(docker ps -a -q --filter ancestor=ghcr.io/dmytro-komlyk/prod-fixlab-admin:latest )) | |
docker rmi ghcr.io/dmytro-komlyk/prod-fixlab-admin:latest | |
fi | |
docker compose -f docker-compose.prod-ci.yml -p fix-lab-prod pull | |
docker compose -f docker-compose.prod-ci.yml -p fix-lab-prod up -d |