Releases are partially automated in BHIMA. This document is a checklist of things that need to be done before a release and the steps to creating a new release.
- Make a new branch called
release-next
that is based onupstream/master
to do your release on. If one exists on upstream, remove it first. - Run
yarn
to ensure you have the latest dependencies. - (Optional, best practice) Test the latest migration script on a production database. (*)
- (Optional, best practice) Build the application in production mode with
NODE_ENV=production yarn build
. - Determine the version number for the next version. (v1.X.Y)
- Create a new folder in the
server/models/migrations/
directory to hold the migration file with the formatv1.A.B-v1.X.Y
where1.A.B
is the current version andv1.X.Y
is the next version. - Move the
server/models/migrations/next/migrate.sql
file to the directory created in the above step. - Create a blank
migrate.sql
file inserver/models/migrations/next/
. - Commit updated files (git commit ...)
- Run
yarn release
and follow the options.
(*) Optional, Best Practice: Test the latest database changes on a production database.
- Change your
.env
so the$DB_NAME
variable is the correct one for a production database. - Create your database migration script by running
yarn migrate
. This will create a filemigration-$DB_NAME.sql
. - Catenate the latest release file into the output
cat server/models/migrations/next/migrate.sql >> migration-$DB_NAME.sql
. - Build the migration script targetting your database.
mysql $DB_NAME < migration-$DB_NAME.sql
- If no errors occur, remove the file
migration-$DB_NAME.sql
to prevent it from getting checked into SQL.