-
Notifications
You must be signed in to change notification settings - Fork 5
35 lines (32 loc) · 1.11 KB
/
deployment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Deploy
on:
push:
branches:
- main
- dev
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Execute Commands on Remote Server
run: |
mkdir -p ~/.ssh
echo "${{ secrets.PUBLIC_KEY }}" > ~/.ssh/id_rsa.pub
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/id_rsa
ssh -p ${{ secrets.REMOTE_PORT }} -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }} << 'EOF'
export PATH="/home/shensquared/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
cd /home/shensquared/gradML
echo "Running on main branch"
git pull origin main
bundle exec jekyll build
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
cd /home/shensquared/gradML_dev
echo "Running on dev branch"
git pull origin dev
bundle exec jekyll build --config _config.yml,_config_dev.yml
fi
EOF