Merge pull request #642 from all-rit/639-create-universal-all-modal #64
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: Staging-Deployment | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
run_build: | |
name: client-server build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- run: git checkout dev | |
- run: cd client | |
- run: npm i --legacy-peer-deps | |
- run: npm run build --if-present | |
- run: cd ../ | |
- run: cd server | |
- run: npm i | |
- run: npm run build --if-present | |
run_server_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: runs deploy script | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_STAGING_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_STAGING_SECRET }} | |
port: ${{ secrets.PORT }} | |
script: | | |
git pull dev | |
cd ${{ secrets.CD_SERVER }} | |
chmod +x server_deploy.sh | |
./server_deploy.sh | |
run_client_deploy: | |
needs: run_server_deploy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: clone repository to deploy action | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- run: git checkout dev | |
- run: | | |
cd client | |
export ${{ secrets.STAGING_ENV_URL }} | |
export ${{ secrets.GA_TRACKING }} | |
export ${{ secrets.LINT_DISABLE }} | |
npm i --legacy-peer-deps | |
npm run build --verbose | |
- name: delete build and create new | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_STAGING_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_STAGING_SECRET }} | |
port: ${{ secrets.PORT }} | |
script: | | |
cd research/client | |
rm -rf build | |
mkdir build | |
- name: tar build to | |
run: | | |
cp -TR client/build ../build | |
tar -cvzf deploy.tar.gz ../build/ | |
- name: scp build directory | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_STAGING_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_STAGING_SECRET }} | |
port: ${{ secrets.PORT }} | |
source: "deploy.tar.gz" | |
target: ${{ secrets.CD_CLIENT }} | |
- name: Unzip build directory | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_STAGING_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_STAGING_SECRET }} | |
port: ${{ secrets.PORT }} | |
script: | | |
cd ${{ secrets.CD_CLIENT }} | |
tar -xvzf deploy.tar.gz | |
- name: delete zipDeploy directory | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_STAGING_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_STAGING_SECRET }} | |
port: ${{ secrets.PORT }} | |
script: | | |
cd ${{ secrets.CD_CLIENT }} | |
rm deploy.tar.gz |