added new event #23
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: Update containers on Remote Host | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up node v16 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- name: Log files in pwd | |
run: ls -al | |
- name: Build image & push to docker hub | |
uses: mr-smithers-excellent/docker-build-push@v6 | |
with: | |
image: rohitshah1706/synergy | |
tags: latest | |
registry: docker.io | |
dockerfile: Dockerfile | |
# buildArgs: VITE_API_GATEWAY_BASE_URL=${{ secrets.VITE_API_GATEWAY_BASE_URL }} | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
deploy-container: | |
needs: build-and-push | |
runs-on: ubuntu-latest | |
if: ${{ success() }} # ! we only want to deploy if the build was successful | |
steps: | |
- name: executing remote ssh commands | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST_IP }} | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
script: | | |
cd synergy23 | |
docker compose pull | |
docker image ls | |
docker compose up -d | |
docker ps -a | |