diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a732a7646b2bf78bbab00f999cfecd95ebb53e01..0ce42b1b2576501f04fcd9b669d5d674c58d9149 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,34 +6,20 @@ before_script: - apk update - apk add nodejs npm - apk add yarn - - apk add curl - export TAG=${CI_COMMIT_TAG:-latest} -build: - stage: build - services: - - docker:18.09.6-dind - parallel: - matrix: - - VERSION: [code, kube] - script: - - ./build.sh $TAG $VERSION $CI_REGISTRY_IMAGE - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.e-biz.fr - - docker push $CI_REGISTRY_IMAGE/$VERSION:$TAG - rules: - - if: $CI_COMMIT_BRANCH == "main" - - if: $CI_COMMIT_TAG != null - - desktop_extension:package:pre-release: stage: build cache: paths: - ./deadlock-plugins/deadlock-extension/ + policy: push script: - ./build-desktop.sh staging rules: - if: $CI_COMMIT_BRANCH == "develop" + - if: $CI_COMMIT_TAG =~ /(?:\d+.){2}(?:\d+)*(1|3|5|7|9)$/ # If tag is like X.Y.Z and Z is odd + desktop_extension:publish:pre-release: stage: publish @@ -43,9 +29,10 @@ desktop_extension:publish:pre-release: policy: pull script: - cd ./deadlock-plugins/deadlock-extension - - npm run vsce-publish -- -pre-release -p $VSCODE_EXTENSION_MARKET_PLACE_ACCESS_TOKEN + - npm run vsce-publish -- --pre-release -p $VSCODE_EXTENSION_MARKET_PLACE_ACCESS_TOKEN rules: - if: $CI_COMMIT_BRANCH == "develop" + - if: $CI_COMMIT_TAG =~ /(?:\d+.){2}(?:\d+)*(1|3|5|7|9)$/ # If tag is like X.Y.Z and Z is odd desktop_extension:package:release: @@ -53,10 +40,12 @@ desktop_extension:package:release: cache: paths: - ./deadlock-plugins/deadlock-extension/ + policy: push + script: - ./build-desktop.sh prod rules: - - if: $CI_COMMIT_BRANCH == "main" + - if: $CI_COMMIT_TAG =~ /(?:\d+.){2}(?:\d+)*(2|4|6|8|0)$/ # If tag is like X.Y.Z and Z is even desktop_extension:publish:release: stage: publish @@ -68,4 +57,4 @@ desktop_extension:publish:release: - cd ./deadlock-plugins/deadlock-extension - npm run vsce-publish -- -p $VSCODE_EXTENSION_MARKET_PLACE_ACCESS_TOKEN rules: - - if: $CI_COMMIT_BRANCH == "main" + - if: $CI_COMMIT_TAG =~ /(?:\d+.){2}(?:\d+)*(2|4|6|8|0)$/ # If tag is like X.Y.Z and Z is even diff --git a/deadlock-plugins/deadlock-extension/docs/README.md b/deadlock-plugins/deadlock-extension/docs/README.md index c24101e2f3ea48b3dbe46de58278e86a648bc763..e5885f73fea2824a160520f17b3dda63947a86ac 100644 --- a/deadlock-plugins/deadlock-extension/docs/README.md +++ b/deadlock-plugins/deadlock-extension/docs/README.md @@ -13,3 +13,36 @@ Vscode extension to show a panel with : - Press `F5` (or use `Run and Debug` tab). If something goes wrong, you may need to kill watch Task terminal between restarts. + +## Build a prod version + +1. Upgrade the version with `npm version`. You can see how to use the command [here](https://docs.npmjs.com/cli/v8/commands/npm-version) + +2. Push + +```shell +git push origin X.Y.Z --tags +``` + +## Release/pre-release management + +For the moment, the vscode marketplace does not fully support semver ([especially the suffixes](https://github.com/microsoft/vsmarketplace/issues/50#issuecomment-990764201)). It is therefore not possible to create an `0.0.1-alpha` version of the extension for example. + +### Publish a pre-release version + +When you push a tag that have a version like X.Y.Z and `Z` is **odd**, a `pre-release` version of the extension is published. + +### Publish a release version + +When you push a tag that have a version like X.Y.Z and `Z` is **even**, a `release` version of the extension is published. + +[More detail on how publish an extension on marketplace](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) + +### Gitlab pipeline to pusblish extension + +The pipeline needs a token from the marketplace in order to publish the extension. + +- The method describing how to retrieve the token is described [here](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#get-a-personal-access-token) +- Then the token must be inserted as the value of the CI/CD variables `VSCODE_EXTENSION_MARKET_PLACE_ACCESS_TOKEN` + +**This token has a maximum lifetime of 1 year** diff --git a/deadlock-plugins/deadlock-extension/package-lock.json b/deadlock-plugins/deadlock-extension/package-lock.json index 4bc90941aa70ab33151d69820d7fa35f7c522129..8be8152843d800e28dc25c1b207de0e7a8a22ad1 100644 --- a/deadlock-plugins/deadlock-extension/package-lock.json +++ b/deadlock-plugins/deadlock-extension/package-lock.json @@ -26,6 +26,7 @@ "@types/vscode": "^1.51.0", "@typescript-eslint/eslint-plugin": "^3.10.1", "@typescript-eslint/parser": "^3.10.1", + "auto-changelog": "^2.4.0", "esbuild": "^0.14.2", "eslint": "^7.32.0", "prettier": "2.6.2", @@ -746,6 +747,54 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, + "node_modules/auto-changelog": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.4.0.tgz", + "integrity": "sha512-vh17hko1c0ItsEcw6m7qPRf3m45u+XK5QyCrrBFViElZ8jnKrPC1roSznrd1fIB/0vR/zawdECCRJtTuqIXaJw==", + "dev": true, + "dependencies": { + "commander": "^7.2.0", + "handlebars": "^4.7.7", + "node-fetch": "^2.6.1", + "parse-github-url": "^1.0.2", + "semver": "^7.3.5" + }, + "bin": { + "auto-changelog": "src/index.js" + }, + "engines": { + "node": ">=8.3" + } + }, + "node_modules/auto-changelog/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/auto-changelog/node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/azure-devops-node-api": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-11.1.0.tgz", @@ -2030,6 +2079,27 @@ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", "dev": true }, + "node_modules/handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -2874,6 +2944,18 @@ "node": ">=6" } }, + "node_modules/parse-github-url": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.2.tgz", + "integrity": "sha512-kgBf6avCbO3Cn6+RnzRGLkUsv4ZVqv/VfAYkRsyBcgkshNvVBkRn1FEZcW0Jb+npXQWm2vHPnnOqFteZxRRGNw==", + "dev": true, + "bin": { + "parse-github-url": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/parse-semver": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", @@ -3739,6 +3821,12 @@ "node": ">=8.17.0" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, "node_modules/ts-node": { "version": "9.1.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", @@ -3860,6 +3948,19 @@ "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", "dev": true }, + "node_modules/uglify-js": { + "version": "3.15.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.4.tgz", + "integrity": "sha512-vMOPGDuvXecPs34V74qDKk4iJ/SN4vL3Ow/23ixafENYvtrNvtbcgUeugTcUGRGsOF/5fU8/NYSL5Hyb3l1OJA==", + "dev": true, + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/underscore": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz", @@ -3989,6 +4090,12 @@ "node": ">= 8" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + }, "node_modules/webpack": { "version": "5.65.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.65.0.tgz", @@ -4110,6 +4217,16 @@ "node": ">=10.13.0" } }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dev": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4149,6 +4266,12 @@ "node": ">=0.10.0" } }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -4786,6 +4909,36 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, + "auto-changelog": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.4.0.tgz", + "integrity": "sha512-vh17hko1c0ItsEcw6m7qPRf3m45u+XK5QyCrrBFViElZ8jnKrPC1roSznrd1fIB/0vR/zawdECCRJtTuqIXaJw==", + "dev": true, + "requires": { + "commander": "^7.2.0", + "handlebars": "^4.7.7", + "node-fetch": "^2.6.1", + "parse-github-url": "^1.0.2", + "semver": "^7.3.5" + }, + "dependencies": { + "commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true + }, + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, + "requires": { + "whatwg-url": "^5.0.0" + } + } + } + }, "azure-devops-node-api": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-11.1.0.tgz", @@ -5753,6 +5906,19 @@ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", "dev": true }, + "handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "dev": true, + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + } + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -6384,6 +6550,12 @@ "callsites": "^3.0.0" } }, + "parse-github-url": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.2.tgz", + "integrity": "sha512-kgBf6avCbO3Cn6+RnzRGLkUsv4ZVqv/VfAYkRsyBcgkshNvVBkRn1FEZcW0Jb+npXQWm2vHPnnOqFteZxRRGNw==", + "dev": true + }, "parse-semver": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", @@ -7030,6 +7202,12 @@ "rimraf": "^3.0.0" } }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, "ts-node": { "version": "9.1.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", @@ -7111,6 +7289,13 @@ "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", "dev": true }, + "uglify-js": { + "version": "3.15.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.4.tgz", + "integrity": "sha512-vMOPGDuvXecPs34V74qDKk4iJ/SN4vL3Ow/23ixafENYvtrNvtbcgUeugTcUGRGsOF/5fU8/NYSL5Hyb3l1OJA==", + "dev": true, + "optional": true + }, "underscore": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz", @@ -7218,6 +7403,12 @@ "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==" }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + }, "webpack": { "version": "5.65.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.65.0.tgz", @@ -7294,6 +7485,16 @@ "integrity": "sha512-cp5qdmHnu5T8wRg2G3vZZHoJPN14aqQ89SyQ11NpGH5zEMDCclt49rzo+MaRazk7/UeILhAI+/sEtcM+7Fr0nw==", "dev": true }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dev": true, + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -7324,6 +7525,12 @@ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/deadlock-plugins/deadlock-extension/package.json b/deadlock-plugins/deadlock-extension/package.json index feab6975fc998549dab6963dc38c47c743025d34..d072fd3628db183504e594ba91ce37b2ede2c787 100644 --- a/deadlock-plugins/deadlock-extension/package.json +++ b/deadlock-plugins/deadlock-extension/package.json @@ -1,7 +1,7 @@ { "name": "deadlock-coding", "description": "Deadlock Coding", - "version": "0.0.3", + "version": "0.0.2", "publisher": "Deadlock", "icon": "media/logo.png", "engines": { @@ -91,7 +91,8 @@ "esbuild": "npm run esbuild-base -- --sourcemap", "esbuild-watch": "npm run esbuild-base -- --sourcemap --watch", "lint": "eslint . --ext .ts,.tsx", - "watch": "tsc -w -p ./" + "watch": "tsc -w -p ./", + "postversion": "git add package*.json && auto-changelog -p && git add CHANGELOG.md && git commit -m \"build: $npm_package_version\" && git tag $npm_package_version && echo \" \\033[31m Don't forget to publish tags (exemple: git push origin $npm_package_version) \\033[0m\"" }, "dependencies": { "@vscode/webview-ui-toolkit": "^1.0.0", @@ -112,6 +113,7 @@ "@types/vscode": "^1.51.0", "@typescript-eslint/eslint-plugin": "^3.10.1", "@typescript-eslint/parser": "^3.10.1", + "auto-changelog": "^2.4.0", "esbuild": "^0.14.2", "eslint": "^7.32.0", "prettier": "2.6.2",