Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
shensquared committed Aug 19, 2024
1 parent 229faf4 commit 25d74d6
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,25 @@ jobs:
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'
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
export PATH="/home/shensquared/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
bundle exec jekyll build
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
cd /home/shensquared/gradML_dev
echo "Running on dev branch"
git pull origin dev
export PATH="/home/shensquared/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
bundle exec jekyll build --config _config.yml,_config_dev.yml
EOF
fi
EOF

0 comments on commit 25d74d6

Please sign in to comment.