Skip to content

Update prod-build-deploy.yml #1

Update prod-build-deploy.yml

Update prod-build-deploy.yml #1

name: Deploy to PROD
on:
push:
branches:
- main
jobs:
build:
name: Generate Build and Deploy to PROD
# 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: 18.0.0
- name: Generate React Build
run: |
yarn install
yarn workspace @shiksha/common-lib build
yarn install
yarn build
- name: Create Lerna Bundles for Submodules
run: |
sh ./scripts/pack-prod-build.sh
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: unnecessary
- name: Add Entry to Known Hosts
run: ssh-keyscan -p ${{ secrets.SSH_PORT}} -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Copy Build Artifact using Rsync
run: rsync -avz -e "ssh -p ${{ secrets.SSH_PORT }}" shiksha-ui.tar ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/ubuntu/shiksha-ui.tar
- name: Unzip Artifact to Correct Locations to Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/ubuntu
tar -xvf shiksha-ui.tar -C /root/testwww/