Skip to content

Workflow file for this run

name: Transfer Build Files
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup SSH
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- name: executing remote ssh commands using passwordss
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/ubuntu/devops-class
git pull origin main
cd all_in_docker
sudo docker-compose build
sudo docker-compose up -d backend
sudo docker-compose up -d frontend
# - name: Transfer Build Files to Ubuntu Instance
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.REMOTE_HOST }}
# username: ${{ secrets.REMOTE_USERNAME }}
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# source: "build"
# target: "/tmp"
# - name: Check ls j
# run: ls
# - name: Check file existence
# id: check_files
# uses: andstor/file-existence-action@v1
# with:
# files: "build"
# allow_failure: true
# - name: Archive Build Files
# uses: actions/upload-artifact@v2
# with:
# name: build
# path: ./build
# transfer-files:
# runs-on: ubuntu-latest
# needs: build
# defaults:
# run:
# working-directory: ./all_in_docker/client
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v2
# - name: Download Build Files
# uses: actions/download-artifact@v2
# with:
# name: build
# path: ./
# - name: Transfer Build Files to Ubuntu Instance
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.REMOTE_HOST }}
# username: ${{ secrets.REMOTE_USERNAME }}
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# source: "build/*"
# target: "/path/on/remote/server/"