From 6773ce84c38d5b3bf310c40ad9491d3d0c4903fa Mon Sep 17 00:00:00 2001 From: Jani Kraner Date: Thu, 1 Mar 2018 15:26:04 +0000 Subject: [PATCH 1/4] Fix unary operator warning --- bin/npm-publish.sh | 2 +- bin/pre-release.sh | 4 ++-- bin/release.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/npm-publish.sh b/bin/npm-publish.sh index f191e4a434..14e3df48e1 100755 --- a/bin/npm-publish.sh +++ b/bin/npm-publish.sh @@ -5,7 +5,7 @@ PACKAGE=$(node -p "require('./package.json').name") VERSION=$(node -p "require('./package.json').version") PUBLISHED=$(npm info $PACKAGE@$VERSION version) -if [ $VERSION == $PUBLISHED ]; then +if [ "$VERSION" == "$PUBLISHED" ]; then echo "⚠️ $PACKAGE@$VERSION is already published!" else echo "📦 Publishing: $PACKAGE@$VERSION" diff --git a/bin/pre-release.sh b/bin/pre-release.sh index b2fb4ffd80..60e1c818c3 100755 --- a/bin/pre-release.sh +++ b/bin/pre-release.sh @@ -19,8 +19,8 @@ if [ $ERROR_CODE != 0 ]; then else # if you cancel lerna publish, it exists with 0 and it doesnt update package.json files so # we exit because package.json file hasn't changed. Otherwise commit changes. - if [ $LATEST_PUBLISHED_TAG == $TAG ]; then - echo "⚠️ Nothing to commit. Run lerna publish again." + if [ "$LATEST_PUBLISHED_TAG" == "$TAG" ]; then + echo "⚠️ Nothing to commit. Rerun the step." exit 1; else git add . && diff --git a/bin/release.sh b/bin/release.sh index 258126e3a3..3397cb62ba 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -7,7 +7,7 @@ set -e # ! npm team ls developers | grep -q $NPM_USER NPM_USER=$(npm whoami) -if ! [ "govuk-patterns-and-tools" = $NPM_USER ]; then +if ! [ "govuk-patterns-and-tools" == "$NPM_USER" ]; then echo "⚠️ FAILURE: You are not logged in with the correct user." exit 1 fi @@ -22,7 +22,7 @@ ALL_PACKAGE_VERSION=$(node -p "require('./packages/all/package.json').version") TAG="v$ALL_PACKAGE_VERSION" LATEST_PUBLISHED_TAG=$(git describe --abbrev=0 --tags) -if [ $LATEST_PUBLISHED_TAG == $TAG ]; then +if [ "$LATEST_PUBLISHED_TAG" == "$TAG" ]; then echo "⚠️ Tag $TAG already exists" exit 1 else From 00a2a939512b12d0162c1b5e20b83ce56bfbff75 Mon Sep 17 00:00:00 2001 From: Jani Kraner Date: Thu, 1 Mar 2018 15:26:16 +0000 Subject: [PATCH 2/4] Fix publish docs --- docs/publishing.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/publishing.md b/docs/publishing.md index 5cae60384b..7cf34435d2 100644 --- a/docs/publishing.md +++ b/docs/publishing.md @@ -22,7 +22,7 @@ scripts in the current directory.* 2. Update `CHANGELOG` version heading with the next version number. -3. Run `npm run prerelease` task. +3. Run `npm run pre-release` task. This will: - run `npm build:packages` that copies any changes from`src/component-name` to `packages/component-name` and runs `after-build-packages.test.js` test to ensure the contents of `packages` matches `src`. @@ -47,11 +47,12 @@ scripts in the current directory.* 4. Create a pull request for these changes. When reviewing the PR check version of compile assets and check release notes for the changes made. 5. Once the pull request is approved, merge to **master** and run `npm run release` in **master**. + This will: - check if you're logged in to NPM as the correct user. If not, it will abort. - run `npm publish` for each package if the package hasn't been published yet - (the currect version matches the version on NPM) - - `git tag v` if current git tag doesn't match latest published tag + (check that the currect version matches the version on NPM) + - run `git tag v` to create a new tag if current git tag doesn't match latest published tag - push the tag to remote with `git push --tags` - create a zip file of the `dist` directory with `git archive -o ./release-.zip HEAD:dist` From b06d6df773267e2bc3f4c5ef0011f785562bc9b0 Mon Sep 17 00:00:00 2001 From: Jani Kraner Date: Thu, 1 Mar 2018 15:33:43 +0000 Subject: [PATCH 3/4] Remap prerelease to pre-release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5e0363f1fc..1b15c13bfd 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "scripts": { "start": "gulp dev", "heroku": "gulp copy-assets && node app/app.js", - "prerelease": "node bin/check-nvmrc.js && ./bin/pre-release.sh", + "pre-release": "node bin/check-nvmrc.js && ./bin/pre-release.sh", "release": "node bin/check-nvmrc.js && ./bin/release.sh", "build:packages": "node bin/check-nvmrc.js && gulp build:packages --destination 'packages' && npm run test:build:packages", "build:dist": "node bin/check-nvmrc.js && gulp build:dist --destination 'dist' && npm run test:build:dist", From 49093ae3e079e5311e7923f78d2a414f9fc0c1f5 Mon Sep 17 00:00:00 2001 From: Jani Kraner Date: Thu, 1 Mar 2018 16:37:06 +0000 Subject: [PATCH 4/4] Document in CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ceda0009a6..9f7b481fec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ Internal: - The button component Sass has been restructured so that e.g. pseudo-selectors are consistently nested within their parents (PR [#552](https://github.com/alphagov/govuk-frontend/pull/552)) +- Fixes for the release process +(PR [#567](https://github.com/alphagov/govuk-frontend/pull/567)) ## 0.0.24-alpha (Breaking release)