Merge pull request #270 from vaibhavsTekdi/vs-7june #60
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 to oblf-21stFeb on digi ocean | |
on: | |
push: | |
branches: | |
- prod-oblf | |
jobs: | |
build: | |
name: Generate Build and Deploy to DEV | |
# environment: PROD | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node Env | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 21.1.0 | |
- name: Generate React Build | |
run: | | |
yarn install | |
yarn build | |
- name: Create Lerna Bundles for Submodules | |
run: | | |
sh ./scripts/pack-prod-build.sh | |
- name: Show PWD | |
run: | | |
echo "Current Working Directory:" | |
pwd | |
- name: List Contents | |
run: | | |
echo "Contents of the current directory (in reverse order):" | |
ls -lr | |
# - name: List Contents | |
# run: | | |
# echo "Contents of the dist directory (in reverse order):" | |
# cd /home/runner/work/shiksha-frontend/shiksha-frontend/dist | |
# ls -lr | |
- name: Deploy to Server 1 | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY_DG }} | |
REMOTE_HOST: ${{ secrets.HOST_DNS_DG }} | |
REMOTE_USER: ${{ secrets.USERNAME_DG }} | |
TARGET: ${{ secrets.TARGET_DIR_DG }} | |
- name: Set up SSH key | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.EC2_SSH_KEY_DG }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
# Add the SSH key to the known_hosts file (replace hostname with your actual hostname) | |
ssh-keyscan -H ${{ secrets.HOST_DNS_DG }} >> ~/.ssh/known_hosts | |
# - name: Deploy with rsync | |
# run: | | |
# rsync -avz -e "ssh -i ~/.ssh/id_rsa" ./dist/ ${{ secrets.USERNAME }}@${{ secrets.HOST_DNS }}:/home/ubuntu/prasad | |
- name: Copy Build Artifact using Rsync | |
run: rsync -avz -e "ssh -p ${{ secrets.PORT }}" shiksha-ui.tar ${{ secrets.USERNAME_DG }}@${{ secrets.HOST_DNS_DG }}:/home/prasad | |
- name: Unzip Artifact to Correct Locations to Deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST_DNS_DG }} | |
username: ${{ secrets.USERNAME_DG }} | |
key: ${{ secrets.EC2_SSH_KEY_DG }} | |
script: | | |
cd /home/prasad | |
tar -xvf shiksha-ui.tar -C /var/www/invigorate.onebillionliterates.org/public |