fix: include cd in github actions #151
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 | |
- 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 -i ${{ secrets.SERVER_SSH_KEY }} ubuntu@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 }} |