react-todolist-deploy #70
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: react-todolist-deploy | |
on: | |
workflow_run: | |
workflows: ["react-todolist"] | |
types: | |
- completed | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Deploy to Oracle Cloud via SSH action | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.ORACLE_HOST }} | |
username: ${{ secrets.ORACLE_USERNAME }} | |
key: ${{ secrets.ORACLE_PRIVATE_KEY }} | |
port: 22 | |
script: | | |
#!/bin/sh | |
# Just run below command - ignore below command. [not working] | |
# sudo docker rm $(sudo docker ps -a | grep react-todolist | awk '{ print $1 }') -f | |
# Stop running react-todolist Docker Containers | |
sudo docker rm react-todolist-app -f | |
# Free up space | |
sudo docker system prune -a | |
# Pull the Docker Image | |
sudo docker pull mail2prajwal12/react-todolist:latest | |
# Run a new container from a new image | |
sudo docker run -d -p 3000:3000 -v $(pwd):/app -v /node_modules --name react-todolist-app mail2prajwal12/react-todolist |