Skip to content

Merge branch 'old-production' into old-dev #181

Merge branch 'old-production' into old-dev

Merge branch 'old-production' into old-dev #181

name: Prod React CI/CD
on:
push:
branches: [ "old-production" ]
pull_request:
branches: [ "old-production" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16]
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: Run the tests
# run: npm run test
- name: Build
env:
REACT_APP_LEADERBOARD_API: ${{ secrets.REACT_APP_LEADERBOARD_API }}
REACT_APP_CTF_SUMISSION_LINK: ${{ secrets.REACT_APP_CTF_SUMISSION_LINK}}
run: npm run build
- name: Configure SSH key
uses: webfactory/[email protected]
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" build/* ubuntu@$REMOTE_IP:$FRONT_PROJECT_PATH