echoing-computer-87366
02/13/2022, 4:31 PMnpm run build
using github action and then just pass that build to nginx server to show new react app running? npm run build on server not working giving me message: The build failed because the process exited too early. This probably means the system ran out of memory or someone called kill -9
on the process.witty-air-63049
02/13/2022, 5:53 PMbuild
, perhaps?). The pull the branch on your Ubuntu server.
Here's a sample GitHub Actions workflow to push a build to a specific branch. https://umanggalaiya.in/blog/2020/github-pages-action.htmlechoing-computer-87366
02/13/2022, 8:17 PM##[error]Process completed with exit code 1.
but once I added CI=false in env it worked any idea why so?echoing-computer-87366
02/13/2022, 8:22 PMwitty-air-63049
02/14/2022, 6:03 AMbut once I added CI=false in env it worked any idea why so?No idea, would need to take a look at your build process to figure out. What's
run: self-hosted
?echoing-computer-87366
02/14/2022, 8:16 AMWhat'sthat is using github runner?run: self-hosted
witty-air-63049
02/14/2022, 9:09 AMechoing-computer-87366
02/14/2022, 9:47 AMname: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-20.04
env:
CI: false
REACT_APP_ENV: ${{ secrets.REACT_APP_ENV }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.14.0
- run: npm ci
- run: npm run build
- uses: actions/checkout@v1
- name: Copy repository contents via scp
uses: appleboy/scp-action@master
env:
HOST: ${{ secrets.LINODE_HOST }}
USERNAME: ${{ secrets.LINODE_USERNAME }}
PORT: ${{ secrets.LINODE_PORT }}
KEY: ${{ secrets.LINODE_SSH_KEY }}
with:
source: "."
target: "/var/www/mywebsite"
but when on remote server I check /var/www/mywebsite I don't see build folder. How can I copy build folder as well to this path: /var/www/mywebsite ?? any suggestions?witty-air-63049
02/14/2022, 10:11 AMechoing-computer-87366
02/14/2022, 10:42 AMname: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-20.04
env:
CI: false
REACT_APP_ENV: ${{ secrets.REACT_APP_ENV }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.14.0
- run: npm ci
- run: npm run build
# Share artifact inside workflow
- name: Share artifact inside workflow
uses: actions/upload-artifact@v1
with:
name: micro-saas-frontend-build
path: build
deploy:
runs-on: ubuntu-20.04
# When application is successfully tested and build has been generated
# Then we can start with deployment
needs: build
steps:
# Download previously shared build
- name: Get artifact
uses: actions/download-artifact@v1
with:
name: micro-saas-frontend-build
- shell: bash
run: |
cd micro-saas-frontend-build
ls
- name: Copy build folder via scp
uses: appleboy/scp-action@master
env:
HOST: ${{ secrets.LINODE_HOST }}
USERNAME: ${{ secrets.LINODE_USERNAME }}
PORT: ${{ secrets.LINODE_PORT }}
KEY: ${{ secrets.LINODE_SSH_KEY }}
with:
source: "micro-saas-frontend-build"
target: "/var/www/mywebsite"
it works fineechoing-computer-87366
02/14/2022, 10:43 AMwitty-air-63049
02/14/2022, 11:35 AM