Merge pull request #23 from itsvick/main #4
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 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 }}:/root/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 /root | |
tar -xvf shiksha-ui.tar -C /var/www/shiksha.uniteframework.io/public |