Skip to content

Commit 25f05fe

Browse files
authored
Merge pull request #2 from MLH-Fellowship/test_gh_actions
Added GH action deploy script
2 parents dde1997 + 2bcee32 commit 25f05fe

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Configure SSH
14+
run: |
15+
mkdir -p ~/.ssh/
16+
echo "$SSH_PRIVATE_KEY" > ~/.ssh/deploy-key.pem
17+
chmod 600 ~/.ssh/deploy-key.pem
18+
cat >> ~/.ssh/config <<END
19+
Host my-droplet
20+
HostName $SSH_IP
21+
User $SSH_USER
22+
IdentityFile ~/.ssh/deploy-key.pem
23+
StrictHostKeyChecking no
24+
END
25+
env:
26+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
27+
SSH_IP: ${{ secrets.SSH_IP }}
28+
SSH_USER: ${{ secrets.SSH_USER }}
29+
30+
- name: Print root dir
31+
run: ssh my-droplet 'cd ${{ secrets.PROJECT_ROOT }} && pwd'

0 commit comments

Comments
 (0)