I would like to start my web server using npm start
which will continue to run even after the GitHub Actions workflow completes. I attempted to do this using the action - run: npm start &
. However, this doesn't work. I suspect this command spawns the web server as a child process of the workflow runner, and once the workflow runner completes all of the steps it terminates and also terminates all of the child processes that it started. Is there a way to start a web server for example that will keep running even after the workflow completes? I know I could use services, but that adds a lot of hassle and I want to keep things simple and in one place.
This is my current workflow:
name: deploy-workflow
on: [push]
jobs:
deploy-job:
runs-on: self-hosted
defaults:
run:
shell: bash
working-directory: ./my-app # Root directory of the repository.
steps:
- uses: actions/checkout@v2 # Check out the repository.
- run: npm stop || true
- run: npm install
- run: npm start &