Merge pull request #107 from SilverCareOrg/stefan #90
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: '16' # Specify the Node.js version | |
- name: Delete node_modules | |
run: rm -rf node_modules/ | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn run build | |
- name: Deploy to Ubuntu Server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_ADDR }} | |
username: stefan | |
key: ${{ secrets.SERVER_KEY }} | |
passphrase: ${{ secrets.SSH_PASSPHRASE }} | |
port: 22 | |
source: build/ # Adjust this path to your build output | |
target: /home/stefan/frontend/ | |
- name: Clean up | |
run: rm -rf build/ |