Merge pull request #59 from SilverCareOrg/stefan #39
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: React App CI/CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
env: | |
REACT_APP_SERVER_IMAGE_PATH: ${{ secrets.REACT_APP_SERVER_IMAGE_PATH }} | |
REACT_APP_API: ${{ secrets.REACT_APP_API }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Delete node_modules | |
run: rm -rf node_modules/ | |
- name: Install dependencies | |
run: npm ci --legacy-peer-deps | |
- name: Build | |
run: npm run build | |
- name: Deploy to Ubuntu Server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_ADDR }} | |
username: ubuntu | |
key: ${{ secrets.SERVER_KEY }} | |
port: 22 | |
source: build/ # Adjust this path to your build output | |
target: /home/ubuntu/sc_frontend/ | |
script: | | |
sudo cp -r /home/ubuntu/sc_frontend/build/* /var/www/html/ | |
- name: Clean up | |
run: rm -rf build/ |