debug #12
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
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 | |
ssh-keyscan -t rsa gradml.mit.edu>> ~/.ssh/known_hosts | |
ssh -p ${{ secrets.REMOTE_PORT }} -i ${{ secrets.SSH_PRIVATE_KEY }} -o StrictHostKeyChecking=no ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }} |