Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2673d6
commit bbbf2b8
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
steps: | ||
- name: node:16-bullseye | ||
entrypoint: npm | ||
args: ['install'] | ||
|
||
- name: node:16-bullseye | ||
entrypoint: npm | ||
args: ['run', 'lint', '${_SERVICE_NAME}'] | ||
|
||
- name: node:16-bullseye | ||
entrypoint: npm | ||
args: ['run', 'test', '${_SERVICE_NAME}'] | ||
|
||
- name: node:16-bullseye | ||
entrypoint: npm | ||
args: | ||
['run', 'build', '${_SERVICE_NAME}', '--', '--configuration=production'] | ||
|
||
- name: node:16-bullseye | ||
entrypoint: bash | ||
args: | ||
[ | ||
'-c', | ||
'node tools/prepare-gcp-app-engine.js --serviceName=${_SERVICE_NAME}', | ||
] | ||
|
||
- name: gcr.io/google.com/cloudsdktool/cloud-sdk:376.0.0-slim | ||
dir: dist/apps/${_SERVICE_NAME} | ||
entrypoint: gcloud | ||
args: | ||
- app | ||
- deploy | ||
- app-engine.yaml | ||
- --version=$SHORT_SHA | ||
- --promote | ||
- --stop-previous-version | ||
- --quiet | ||
|
||
substitutions: | ||
_SERVICE_NAME: game-api |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const yargs = require('yargs/yargs'); | ||
console.log('Prepare GCP App Engine: ', new Date().toISOString()); | ||
|
||
const { serviceName } = yargs(process.argv).argv; | ||
if (!serviceName) { | ||
console.error('Missing serviceName args. Eg: --serviceName=explore-api'); | ||
process.exit(1); | ||
} | ||
|
||
const PACKAGE_PATH = path.join('dist', 'apps', serviceName, 'package.json'); | ||
|
||
function main() { | ||
const packageJson = fs.readFileSync(PACKAGE_PATH).toString(); | ||
const scripts = { | ||
start: 'node main.js', | ||
}; | ||
|
||
const newPackageJson = { | ||
...JSON.parse(packageJson), | ||
scripts, | ||
}; | ||
|
||
fs.writeFileSync(PACKAGE_PATH, JSON.stringify(newPackageJson, null, 2)); | ||
|
||
console.log( | ||
'Updated package.json: ', | ||
fs.readFileSync(PACKAGE_PATH).toString() | ||
); | ||
} | ||
|
||
main(); |