bitburner-src/tools/build-release.sh
Martin Fournier 078a62cb0d Add npm version support to build releases
Replaces the `npm run allbuild` script with the `npm version` command.
It creates a new commit with a standardized message & includes the built
app.

Usage: `npm version [patch | minor | version | 10.0.0 | etc]`

Will update the package.json & perform a bunch of steps in a row:

- Runs `npm install` in:
  - The root directory
  - The ./electron/ directory
  - The ./tools/bump-version/ directory
- Runs `npm run test`
- Update the version string in:
  - ./electron/package.json (version)
  - ./src/Constants.ts (VersionString)
  - ./doc/source/conf.py (version & release)
- Runs `npm run doc` (build the markdown documentation)
- Runs `npm run build` (production build)
- Runs `npm run electron` (electron build)
- Runs `git add --all`
- Runs `git push -u origin dev && git push --tags`
2022-04-07 07:50:47 -04:00

47 lines
1.1 KiB
Bash

#!/bin/sh
# See https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425
set -euxo pipefail
APP_VERSION=$(npm pkg get version | sed 's/"//g')
echo ''
echo '|============================================|'
echo " Preparing build v$APP_VERSION"
echo ' Taken from the root ./package.json file.'
echo '|============================================|'
echo ''
sleep 1
echo 'Do you need to increment the save file version?'
echo 'If you do, cancel/exit this script now.'
echo 'Update the following file before running this script: '
echo '> ./src/Constants.ts'
echo ''
sleep 2
echo 'Do you want to include a changelog with this release?'
echo 'If you do, cancel/exit this script now.'
echo 'Update the following file before running this script: '
echo '> ./src/Constants.ts'
echo '> ./doc/source/changelog.rst'
echo ''
sleep 2
cd ./tools/bump-version
npm ci
cd ../../
node ./tools/bump-version/basic.js --version $APP_VERSION
echo ''
echo 'Building bundles in 2 seconds...'
sleep 2
echo ''
echo 'Starting build...'
npm run doc && \
npm run build && \
npm run electron
echo ''
echo 'Completed!'
echo ''