Merge pull request #1952 from gtech-mulearn/home-dev #298
This file contains hidden or 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: Prod React CI/CD | |
| on: | |
| push: | |
| branches: [ "home-prod" ] | |
| pull_request: | |
| branches: [ "home-prod" ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Install Vite | |
| run: npm install -g vite | |
| - name: Build | |
| env: | |
| REACT_APP_LEADERBOARD_API: ${{ secrets.REACT_APP_LEADERBOARD_API }} | |
| REACT_APP_CTF_SUMISSION_LINK: ${{ secrets.REACT_APP_CTF_SUMISSION_LINK}} | |
| VITE_HOME_MULEARN_URL: ${{ vars.VITE_HOME_MULEARN_URL }} | |
| VITE_APP_MULEARN_URL: ${{ vars.VITE_APP_MULEARN_URL }} | |
| VITE_S3_CDN_URL: ${{ vars.VITE_S3_CDN_URL }} | |
| VITE_HR_FORM_API_URL: ${{vars.VITE_HR_FORM_API_URL}} | |
| run: npm run build | |
| - name: Configure SSH key | |
| uses: webfactory/ssh-agent@v0.4.1 | |
| with: | |
| ssh-private-key: ${{ secrets.PROD_SSH_PRIVATE_KEY }} | |
| - name: Deploy | |
| env: | |
| REMOTE_IP: ${{ secrets.PROD_REMOTE_IP }} | |
| FRONT_PROJECT_PATH: ${{ secrets.FRONT_PROJECT_PATH }} | |
| run: | | |
| ssh -o StrictHostKeyChecking=no ubuntu@$REMOTE_IP "rm -fr $FRONT_PROJECT_PATH/*" | |
| rsync -avz -e "ssh -o StrictHostKeyChecking=no" dist/* ubuntu@$REMOTE_IP:$FRONT_PROJECT_PATH |