forked from CloudBotIRC/CloudBot
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setting up this repo to push to a private EC2 instance where the running version is hosted.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Deploy CloudBotIRC to Bots EC2 Instance. | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install OpenSSH and rsync | ||
run: | | ||
sudo apt-get install -y openssh-client rsync | ||
- name: Start SSH Agent and Add Key | ||
run: | | ||
eval "$(ssh-agent -s)" | ||
ls -al $GITHUB_WORKSPACE/.ssh | ||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > $GITHUB_WORKSPACE/.ssh/${{ secrets.SSH_USER }} | ||
chmod 600 $GITHUB_WORKSPACE/.ssh/${{ secrets.SSH_USER }} | ||
ssh-add $GITHUB_WORKSPACE/.ssh/${{ secrets.SSH_USER }} | ||
rm $GITHUB_WORKSPACE/.ssh/${{ secrets.SSH_USER }} | ||
- name: Add EC2 instance to known hosts | ||
run: | | ||
ssh-keyscan -t ed25519 ${{ secrets.SSH_HOST }} >> $GITHUB_WORKSPACE/.ssh/known_hosts | ||
- name: Sync files to EC2 using rsync | ||
run: | | ||
rsync -avz --delete --exclude='.git' $GITHUB_WORKSPACE/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.WORK_DIR }} |