Skip to content

show notes link on dev site #18

show notes link on dev site

show notes link on dev site #18

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
- dev
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# - name: Checkout Code
# uses: actions/checkout@v2
# - name: Set Up SSH Agent
# env:
# SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} # Ensure you have added the SSH private key as a secret
# run: |
# echo "$SSH_PRIVATE_KEY" > private_key
# chmod 600 private_key
# eval "$(ssh-agent -s)"
# ssh-add private_key
- 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
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
ssh -p ${{ secrets.REMOTE_PORT }} -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }} << 'EOF'
cd /home/shensquared/gradML
echo "Running on main branch"
git pull origin main
EOF
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
ssh -p ${{ secrets.REMOTE_PORT }} -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }} << 'EOF'
cd /home/shensquared/gradML_dev # Replace with the relevant folder path
echo "Running on dev branch"
git pull origin dev
EOF
fi