Skip to content

fix: include cd in github actions #149

fix: include cd in github actions

fix: include cd in github actions #149

# 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
- name: Build and export with the latest action rev
uses: praneeth-rdy/static-build-export-action@main
env:
CI: false
PROJECT_DIR: .
BUILD_BRANCH: build
TOKEN: ${{ secrets.ACTIONS_TOKEN }}
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 ec2-65-1-222-220.ap-south-1.compute.amazonaws.com 'cd ./tsg-backend/ && ./.git/hooks/post-receive'
env:
SERVER_SSH_KEY: ${{ secrets.SERVER_SSH_KEY }}