From 3d7f5f42e4c2046a5cf25ffcfb6a7d846063eedf Mon Sep 17 00:00:00 2001 From: EEA Jenkins Date: Thu, 9 Sep 2021 23:57:33 +0300 Subject: [PATCH 1/7] Add Sonarqube tag using ims-frontend addons list --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 22eef97..d0dfe1a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { environment { GIT_NAME = "volto-editing-progress" NAMESPACE = "@eeacms" - SONARQUBE_TAGS = "volto.eea.europa.eu" + SONARQUBE_TAGS = "volto.eea.europa.eu,www.eea.europa.eu-ims" DEPENDENCIES = "" } From ecaea55e1987fdcf4228075fa05414f71922ba0c Mon Sep 17 00:00:00 2001 From: valentinab25 Date: Tue, 23 Nov 2021 19:43:55 +0200 Subject: [PATCH 2/7] Refs #142010 - Optimize Volto-addons gitflow pipelines --- Jenkinsfile | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d0dfe1a..58cff9c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,6 +11,13 @@ pipeline { stages { stage('Code') { + when { + allOf { + environment name: 'CHANGE_ID', value: '' + not { branch 'master' } + not { changelog '.*^Automated release [0-9\\.]+$' } + } + } steps { parallel( @@ -36,6 +43,13 @@ pipeline { } stage('Tests') { + when { + allOf { + environment name: 'CHANGE_ID', value: '' + not { branch 'master' } + not { changelog '.*^Automated release [0-9\\.]+$' } + } + } steps { parallel( @@ -75,6 +89,13 @@ pipeline { } stage('Integration tests') { + when { + allOf { + environment name: 'CHANGE_ID', value: '' + not { branch 'master' } + not { changelog '.*^Automated release [0-9\\.]+$' } + } + } steps { parallel( @@ -122,11 +143,13 @@ pipeline { } stage('Report to SonarQube') { - // Exclude Pull-Requests when { - allOf { environment name: 'CHANGE_ID', value: '' - } + anyOf { + branch 'master' + branch 'develop' + } + not { changelog '.*^Automated release [0-9\\.]+$' } } steps { node(label: 'swarm') { @@ -156,8 +179,8 @@ pipeline { steps { node(label: 'docker') { script { - if ( env.CHANGE_BRANCH != "develop" && !( env.CHANGE_BRANCH.startsWith("hotfix")) ) { - error "Pipeline aborted due to PR not made from develop or hotfix branch" + if ( env.CHANGE_BRANCH != "develop" ) { + error "Pipeline aborted due to PR not made from develop branch" } withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) { sh '''docker pull eeacms/gitflow''' From 0923d34abe39842aca0c9762174e7566500c87ae Mon Sep 17 00:00:00 2001 From: valentinab25 Date: Fri, 3 Dec 2021 18:35:29 +0200 Subject: [PATCH 3/7] [JENKINS] Refs #142010 - Optimize Volto-addons gitflow pipelines --- Jenkinsfile | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 58cff9c..32e6f16 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,6 +10,23 @@ pipeline { stages { + stage('Release') { + when { + allOf { + environment name: 'CHANGE_ID', value: '' + branch 'master' + } + } + steps { + node(label: 'docker') { + withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) { + sh '''docker pull eeacms/gitflow''' + sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e GIT_TOKEN="$GITHUB_TOKEN" -e NPM_TOKEN="$NPM_TOKEN" -e LANGUAGE=javascript eeacms/gitflow''' + } + } + } + } + stage('Code') { when { allOf { @@ -46,7 +63,6 @@ pipeline { when { allOf { environment name: 'CHANGE_ID', value: '' - not { branch 'master' } not { changelog '.*^Automated release [0-9\\.]+$' } } } @@ -92,7 +108,6 @@ pipeline { when { allOf { environment name: 'CHANGE_ID', value: '' - not { branch 'master' } not { changelog '.*^Automated release [0-9\\.]+$' } } } @@ -191,23 +206,6 @@ pipeline { } } - stage('Release') { - when { - allOf { - environment name: 'CHANGE_ID', value: '' - branch 'master' - } - } - steps { - node(label: 'docker') { - withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) { - sh '''docker pull eeacms/gitflow''' - sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e GIT_TOKEN="$GITHUB_TOKEN" -e NPM_TOKEN="$NPM_TOKEN" -e LANGUAGE=javascript eeacms/gitflow''' - } - } - } - } - } post { From 1f8fc09494243d4b6a9ee096e90f6fa21eb467b2 Mon Sep 17 00:00:00 2001 From: valentinab25 Date: Mon, 13 Dec 2021 21:39:41 +0200 Subject: [PATCH 4/7] [JENKINS] Refs #142010 - Optimize Volto-addons gitflow pipelines --- Jenkinsfile | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 32e6f16..00f5b1c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,8 +31,8 @@ pipeline { when { allOf { environment name: 'CHANGE_ID', value: '' - not { branch 'master' } not { changelog '.*^Automated release [0-9\\.]+$' } + not { branch 'master' } } } steps { @@ -63,7 +63,10 @@ pipeline { when { allOf { environment name: 'CHANGE_ID', value: '' - not { changelog '.*^Automated release [0-9\\.]+$' } + anyOf { + not { changelog '.*^Automated release [0-9\\.]+$' } + branch 'master' + } } } steps { @@ -108,7 +111,10 @@ pipeline { when { allOf { environment name: 'CHANGE_ID', value: '' - not { changelog '.*^Automated release [0-9\\.]+$' } + anyOf { + not { changelog '.*^Automated release [0-9\\.]+$' } + branch 'master' + } } } steps { @@ -159,12 +165,16 @@ pipeline { stage('Report to SonarQube') { when { + allOf { environment name: 'CHANGE_ID', value: '' anyOf { branch 'master' - branch 'develop' + allOf { + branch 'develop' + not { changelog '.*^Automated release [0-9\\.]+$' } + } } - not { changelog '.*^Automated release [0-9\\.]+$' } + } } steps { node(label: 'swarm') { From 62c51d71b3586eaa4cfba7a9ead5e2970a536624 Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Tue, 14 Dec 2021 22:17:45 +0200 Subject: [PATCH 5/7] Add SonarQube badges --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7c0edeb..b0b2667 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,24 @@ # volto-editing-progress [![Releases](https://img.shields.io/github/v/release/eea/volto-editing-progress)](https://github.com/eea/volto-editing-progress/releases) + [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-editing-progress%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-editing-progress/job/master/display/redirect) +[![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-master&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-master) +[![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-master&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-master) +[![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-master&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-master) +[![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-master&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-master) + [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-editing-progress%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-editing-progress/job/develop/display/redirect) +[![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-develop) +[![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-develop) +[![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-develop) +[![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-editing-progress-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-editing-progress-develop) + -[Volto](https://github.com/plone/volto) add-on +[Volto](https://github.com/plone/volto) add-on: Editing progress ## Features -Demo GIF +Document Editing progress bar in Volto ## Getting started From 364be5e173914ac277cf5e3001d710d4be5d38d8 Mon Sep 17 00:00:00 2001 From: EEA Jenkins <@users.noreply.github.com> Date: Tue, 14 Dec 2021 20:24:50 +0000 Subject: [PATCH 6/7] Automated release 0.1.6 --- CHANGELOG.md | 10 ++++++++-- package.json | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39633c5..7a3303d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [0.1.6](https://github.com/eea/volto-editing-progress/compare/0.1.5...0.1.6) + +- Add SonarQube badges [`62c51d7`](https://github.com/eea/volto-editing-progress/commit/62c51d71b3586eaa4cfba7a9ead5e2970a536624) +- Refs #142010 - Optimize Volto-addons gitflow pipelines [`ecaea55`](https://github.com/eea/volto-editing-progress/commit/ecaea55e1987fdcf4228075fa05414f71922ba0c) + #### [0.1.5](https://github.com/eea/volto-editing-progress/compare/0.1.4...0.1.5) +> 24 June 2021 + +- Refs #124587 ensure we have document sidebar active on edit: [`#5`](https://github.com/eea/volto-editing-progress/pull/5) - Refs #124587 lint fix: [`1fdaf0a`](https://github.com/eea/volto-editing-progress/commit/1fdaf0a2b7d003bc4c153b33f3d42dc02ed0359b) -- Refs #124587 ensure we have document sidebar active on edit: [`a070c42`](https://github.com/eea/volto-editing-progress/commit/a070c42c8fa495c9a094860c7c81e9f8b72890ff) #### [0.1.4](https://github.com/eea/volto-editing-progress/compare/0.1.3...0.1.4) @@ -35,7 +42,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). > 10 June 2021 - Cypress code coverage [`#1`](https://github.com/eea/volto-editing-progress/pull/1) -- [JENKINS] - Fix stylelint [`53ea81b`](https://github.com/eea/volto-editing-progress/commit/53ea81b9fd99913adbec69b25f2b456c40d4c5a7) - Refs #124587 lint fixing [`2bc7ffa`](https://github.com/eea/volto-editing-progress/commit/2bc7ffa48535a1f032bfbfa242f0d0f9c09ad9b2) - Refs #124587 wip setting bullets for soft required fields on edit [`5d0cd54`](https://github.com/eea/volto-editing-progress/commit/5d0cd54200117bda9b2fb9bb1ec56f270b6d3c33) - Refs #124587 changed the following: [`5ac614f`](https://github.com/eea/volto-editing-progress/commit/5ac614f89fd9bef5775052f5ec1a171256235d1e) diff --git a/package.json b/package.json index b0c4be5..5290706 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eeacms/volto-editing-progress", - "version": "0.1.5", + "version": "0.1.6", "description": "@eeacms/volto-editing-progress: Volto add-on", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", From 2087e0865ed3cc18e9a8f4bad9fd9e26901c5cde Mon Sep 17 00:00:00 2001 From: valentinab25 Date: Thu, 16 Dec 2021 19:36:22 +0200 Subject: [PATCH 7/7] [JENKINS] Refs #142742 - Add release documentation --- README.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 ++ 2 files changed, 78 insertions(+) diff --git a/README.md b/README.md index b0b2667..1341145 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # volto-editing-progress + [![Releases](https://img.shields.io/github/v/release/eea/volto-editing-progress)](https://github.com/eea/volto-editing-progress/releases) [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-editing-progress%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-editing-progress/job/master/display/redirect) @@ -81,6 +82,81 @@ Document Editing progress bar in Volto 1. Happy editing! +## Release + +### Automatic release using Jenkins + +* The automatic release is started by creating a [Pull Request](../../compare/master...develop) from `develop` to `master`. The pull request status checks correlated to the branch and PR Jenkins jobs need to be processed successfully. 1 review from a github user with rights is mandatory. +* It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits. +* The automatic release is done by [Jenkins](https://ci.eionet.europa.eu). The status of the release job can be seen both in the Readme.md badges and the green check/red cross/yellow circle near the last commit information. If you click on the icon, you will have the list of checks that were run. The `continuous-integration/jenkins/branch` link goes to the Jenkins job execution webpage. +* Automated release scripts are located in the `eeacms/gitflow` docker image, specifically [js-release.sh](https://github.com/eea/eea.docker.gitflow/blob/master/src/js-release.sh) script. It uses the `release-it` tool. +* As long as a PR request is open from develop to master, the PR Jenkins job will automatically re-create the CHANGELOG.md and package.json files to be production-ready. +* The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0). +* You can manually change the version in `package.json`. The new version must not be already present in the tags/releases of the repository, otherwise it will be automatically increased by the script. Any changes to the version will trigger a `CHANGELOG.md` re-generation. +* Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file. + +### Manual release from the develop branch ( beta release ) + +#### Installation and configuration of release-it + +You need to first install the [release-it](https://github.com/release-it/release-it) client. + + ``` + npm install -g release-it + ``` + +Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository. + +Release-it is a tool that automates 4 important steps in the release process: + +1. Version increase in `package.json` ( increased from the current version in `package.json`) +2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases ) +3. GitHub release on the commit with the changelog and package.json modification on the develop branch +4. NPM release ( by default it's disabled, but can be enabled in the configuration file ) + +To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens) + + ``` + export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX + ``` + + To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN : + + ``` + echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc + ``` + +#### Using release-it tool + +There are 3 yarn scripts that can be run to do the release + +##### yarn release-beta + +Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input). + +``` +? Select increment (next version): +❯ prepatch (0.1.1-beta.0) + preminor (0.2.0-beta.0) + premajor (1.0.0-beta.0) + Other, please specify... +``` + +##### yarn release-major-beta + +Same as `yarn release-beta`, but with premajor version pre-selected. + +##### yarn release + +Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other. + +#### Important notes + +> Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST. + +> Do not keep Pull Requests from develop to master branches open when you are doing beta releases from the develop branch. As long as a PR to master is open, an automatic script will run on every commit and will update both the version and the changelog to a production-ready state - ( MAJOR.MINOR.PATCH mandatory format for version). + + ## How to contribute See [DEVELOP.md](https://github.com/eea/volto-editing-progress/blob/master/DEVELOP.md). diff --git a/package.json b/package.json index 5290706..22c2b34 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,8 @@ }, "scripts": { "release": "release-it", + "release-major-beta": "release-it major --preRelease=beta", + "release-beta": "release-it --preRelease=beta", "bootstrap": "npm install -g ejs; npm link ejs; node bootstrap", "stylelint": "../../../node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'", "stylelint:overrides": "../../../node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'",