score:3

Accepted answer

https://cloud.google.com/source-repositories/docs/quickstart-triggering-builds-with-source-repositories

Found what you are looking for!

This will make it so every time you commit, google app engine automatically redeploys.

Edit

server.js

const express = require('express');
const path = require('path');
const app = express();

app.use(express.static(path.join(__dirname, 'build')));

app.get('/', function(req, res) {
  res.sendFile(path.join(__dirname, 'build', 'index.html'));
});

app.listen(8080);

In your package.json, add "build:gcp": "react-scripts build && node server.js", to it.

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.5.0",
    "react-dom": "^16.5.0",
    "react-redux": "^5.0.7",
    "react-router-dom": "^4.3.1",
    "react-scripts": "1.1.5",
    "redux": "^4.0.0",
    "redux-thunk": "^2.3.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "build:gcp": "react-scripts build && node server.js"
  },
  "devDependencies": {
    "enzyme": "^3.6.0",
    "enzyme-adapter-react-16": "^1.5.0"
  }
}

Now when you deploy your app, run the npm run build:gcp command and you will know for sure your app is running in production mode.


Related Query

More Query from same tag