fix: ssh issue, attempt 2 #154
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
# Trigger the workflow on push or pull request | |
name: Build and Export the static build to the 'build' branch | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build-and-export: | |
name: Build and export the react application to the `build` branch | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
deploy: | |
needs: build-and-export | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up SSH key | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SERVER_SSH_KEY" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
env: | |
SERVER_SSH_KEY: ${{ secrets.SERVER_SSH_KEY }} | |
- name: SSH into remote server | |
run: | | |
SSH_ASKPASS=/bin/true ssh -o StrictHostKeyChecking=no -i - ubuntu@ec2-65-1-222-220.ap-south-1.compute.amazonaws.com 'cd ./tsg-backend/ && ./.git/hooks/post-receive' <<< "${{ secrets.SERVER_SSH_KEY }}" | |
env: | |
SERVER_SSH_KEY: ${{ secrets.SERVER_SSH_KEY }} |