Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample Workflow
on:
push:
branches:
- master
jobs:
deploy-to-digital-ocean-droplet:
runs-on: ubuntu-latest
name: Deploy Website
steps:
- name: Checkout master
uses: actions/checkout@master
- name: Pull from GitHub
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_IP }}
username: ${{ secrets.HOST_USERNAME }}
password: ${{ secrets.HOST_PASSWORD }}
script: cd ~/path/to/project && git pull git@github.com:project/home.git
- name: Docker Build
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_IP }}
username: ${{ secrets.HOST_USERNAME }}
password: ${{ secrets.HOST_PASSWORD }}
script: cd ~/path/to/project && docker built -t <container> .
...
@chaudharykiran

This comment has been minimized.

Copy link

@chaudharykiran chaudharykiran commented Aug 19, 2020

Does it still work for you? I am getting dial tcp ***:22: i/o timeout.

@leonson

This comment has been minimized.

Copy link
Owner Author

@leonson leonson commented Aug 19, 2020

Does it still work for you? I am getting dial tcp ***:22: i/o timeout.

This is sample I used here, not supposed to "just work" if copy-pasting, you want to debug the error you got. My actual workflow works well.

@chaudharykiran

This comment has been minimized.

Copy link

@chaudharykiran chaudharykiran commented Aug 20, 2020

I am using Droplet IP address as host, root as username, my digitalocean password as password. But still it is not working. Any hint?

@leonson

This comment has been minimized.

Copy link
Owner Author

@leonson leonson commented Aug 20, 2020

root as username, my digitalocean password as password

This combination doesn't look right. You want to use user/password you usually use to login the droplet, not the password you login to digitalocean.com

Also it's dangerous to expose root user in first place. You want to create a different unix user (hint: useradd) rather than root to do the work on your Droplet.

@chaudharykiran

This comment has been minimized.

Copy link

@chaudharykiran chaudharykiran commented Aug 20, 2020

You want to use user/password you usually use to login the droplet.

My droplet don't have password. I am using ssh to login my droplet from my local machine. What to use in this case?

@leonson

This comment has been minimized.

Copy link
Owner Author

@leonson leonson commented Aug 20, 2020

@chaudharykiran in this case you either useradd or figure out how to configure your GitHub repo to SSH into your Droplet, like you did on your local machine. appleboy/ssh-action may or may not have option.

@ahmedsadman

This comment has been minimized.

Copy link

@ahmedsadman ahmedsadman commented Aug 25, 2020

What if I don't use Docker? Can I still use this ssh-action tool?

@leonson

This comment has been minimized.

Copy link
Owner Author

@leonson leonson commented Aug 26, 2020

@ahmedsadman yes you can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.