Commit 3bb3a92b authored by Mathias Chouet's avatar Mathias Chouet 🍝
Browse files

Update README and scripts for deployment of new stable version

parent c419b966
......@@ -30,6 +30,7 @@ jalhyd:
- web
script:
- JALHYD_BRANCH=`cat jalhyd_branch`
- echo "CI_COMMIT_REF_NAME - $CI_COMMIT_REF_NAME"
- if [ "$CI_COMMIT_REF_NAME" = "master" ]; then JALHYD_BRANCH="master"; fi
- if [ "$CI_COMMIT_REF_NAME" = "devel" ]; then JALHYD_BRANCH="devel"; fi
- echo "Branche JalHyd - $JALHYD_BRANCH"
......
......@@ -251,20 +251,39 @@ sudo find /usr/lib/node_modules/protractor -regextype sed -regex "^.*/chromedriv
Use [semantic versioning](https://semver.org/).
Before releasing a new stable version, one should complete the following files
**It's discouraged to execute release steps manually, see Release Script below**
Before releasing a new stable version, a new version of JaLHyd should be tagged, see
Then, one should complete the following files
- `CHANGELOG.md`
- `package.json` (update "version")
- `package.json` (update "version", or use `npm version`)
- `jalhyd_branch` (be sure that it contains "master" or is empty)
Every stable version should be tagged with both
- the `stable` tag
- a version tag of the form `X.Y.Z` (semver)
The `stable` tag should be set **before** the version tag, so that `git describe` returns `X.Y.Z` (latest tag).
The `stable` tag should be set **before** the version tag, so that `git describe` returns `X.Y.Z` (latest tag). There should be **at least 1s** between the two tag commands, so that date sorting is not confused.
### Release script
**Important:** the release script assumes that you run it from the current nghyd source directory `nghyd`, and that JaLHyd source directory `jalhyd` is present at the same level.
This script:
* checks out "master" branch of JaLHyd, pulls the latest changes, installs dependencies, runs unit tests, commits changes if any
* updates JaLHyd version, commits changes
* creates the right tags for JaLHyd and pushes them
* checks out "master" branch of NgHyd, pulls the latest changes, installs dependencies, commits changes if any
* updates NgHyd version, commits changes
* creates the right tags for NgHyd and pushes them
It **does not** check that `jalhyd_branch` is OK nor that `jalhyd/CHANGELOG.md` and `nghyd/CHANGELOG.md` are up to date, but reminds you to do it.
Once tags are pushed, Gitlab CI/CD takes care of building and deploying the new packages.
Example for a **4.10.4** version :
Here are the steps to follow for an example **4.5.0** version
```sh
git tag -fa stable
git tag -fa 4.5.0
git push --tags --force
./scripts/deploy-new-stable-version.sh 4.10.4
```
#!/bin/bash
# Use this script to tag new stable versions of JaLHyd and NgHyd, to be then built and deployed by Gitlab CI/CD
#
# This script requires:
# * bash
# * git
# * npm
# exit on error
set -e
VERSION=$1
if [[ $VERSION == "" ]]
then
echo "Utilisation: $0 x.y.z
ex: $0 4.7.0"
exit 1
fi
# 0. changelog
read -p "Avez-vous rempli jalhyd_branch, et les CHANGELOG de JaLHyd et NgHyd pour la version $VERSION ? (o/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Oo]$ ]]
then
echo "Remplissez d'abord nghyd/jalhyd_branch, jalhyd/CHANGELOG.md et nghyd/CHANGELOG.md, puis faites 'commit' et 'push' dans chaque dépôt"
exit 2
fi
# 1. JaLHyd ###################################################################
echo "BUILDING JALHYD"
cd ../jalhyd
# 1.2 update Git repository and test
git checkout master
git pull --rebase
npm install
npm run jasmine
if [ ! -z "$(git status --porcelain)" ]
then
echo "commiting changes induced by 'npm install'"
git commit -a -m "verify dependencies (npm install) before deploying version $VERSION"
fi
# 1.3 version in package.*
npm version "$VERSION" --allow-same-version --git-tag-version=false
if [ ! -z "$(git status --porcelain)" ]
then
echo "commiting changes induced by 'npm version'"
git commit -a -m "update package.* to version $VERSION"
fi
# 1.4 tags
git tag -fa "nghyd_$VERSION" -m "release version $VERSION"
sleep 1
git tag -fa stable -m "stable version"
# 1.5 push code, push tags
git push
git push --tags --force
# 2. NgHyd ####################################################################
echo "BUILDING NGHYD"
cd ../nghyd
# 2.2 update Git repository
git checkout master
git pull --rebase
npm install
if [ ! -z "$(git status --porcelain)" ]
then
echo "commiting changes induced by 'npm install'"
git commit -a -m "verify dependencies (npm install) before deploying version $VERSION"
fi
# 2.3 version in package.*
npm version "$VERSION" --allow-same-version --git-tag-version=false
if [ ! -z "$(git status --porcelain)" ]
then
echo "commiting changes induced by 'npm version'"
git commit -a -m "update package.* to version $VERSION"
fi
# 2.4 tags
git tag -fa stable -m "stable version"
sleep 1
git tag -fa "$VERSION" -m "release version $VERSION"
# 2.5 push code, push tags
git push
git push --tags --force
echo "Tagging done, Gitlab CI/CD should take care of the rest."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment