diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cee42fd..96a9d8e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,14 @@ jobs: npm install $date = Get-Date -format "yyMMddHHmm" $version = "${{steps.gitversion.outputs.majorMinorPatch}}.$date" - $override = '{\"version\": \"' + $version + '\"}' - npm run publish-azure -- --token ${{ secrets.TFX_TOKEN }} --override $override + $major = "${{steps.gitversion.outputs.major}}" + $minor = "${{steps.gitversion.outputs.minor}}" + + . .\dist\azure\update-version.ps1 + update-manifest .\dist\azure\vss-extension.json -Version $version + update-task .\dist\azure\setup-gitversion\task.json -Major $major -Minor $minor + update-task .\dist\azure\execute-gitversion\task.json -Major $major -Minor $minor + + npm run publish-azure -- --token ${{ secrets.TFX_TOKEN }} shell: pwsh name: Publish Azure extension diff --git a/dist/azure/execute-gitversion/task.json b/dist/azure/execute-gitversion/task.json index 9eddef8..717e3f1 100644 --- a/dist/azure/execute-gitversion/task.json +++ b/dist/azure/execute-gitversion/task.json @@ -84,5 +84,5 @@ "helpMarkDown": "Additional arguments to send to GitVersion", "groupName": "additional" } - ], + ] } \ No newline at end of file diff --git a/dist/azure/setup-gitversion/lib.json b/dist/azure/setup-gitversion/lib.json new file mode 100644 index 0000000..8a23d4c --- /dev/null +++ b/dist/azure/setup-gitversion/lib.json @@ -0,0 +1,14 @@ +{ + "messages": { + "TOOL_LIB_CachingTool": "Caching tool: %s %s %s", + "_TOOL_LIB_CachingTool.comment": "This informational log message indicates that a tool, that was just downloaded, is being copied into the cache directory. %s %s %s represent the tool name, version information, and processor architecture.", + "TOOL_LIB_Downloading": "Downloading: %s", + "_TOOL_LIB_Downloading.comment": "This information log message indicates that a file is being downloaded. %s represents the URL being downloaded.", + "TOOL_LIB_ExtractingArchive": "Extracting archive", + "_TOOL_LIB_ExtractingArchive.comment": "This informational log message indicates that an archive file is being extracted. For example, a .zip file, .7z file, or .tar.gz file.", + "TOOL_LIB_FoundInCache": "Found tool in cache: %s %s %s", + "_TOOL_LIB_FoundInCache.comment": "This informational log message indicates that the request tool is already cached, and does not need to be downloaded again. %s %s %s represent the tool name, version information, and processor architecture.", + "TOOL_LIB_PrependPath": "Prepending PATH environment variable with directory: %s", + "_TOOL_LIB_PrependPath.comment": "This informational log message indicates that a directory is being prepended to the front of the PATH environment variable. The directories specified by the PATH environment variable are used to resolve the location of command line tools." + } +} \ No newline at end of file diff --git a/dist/azure/setup-gitversion/lib1.json b/dist/azure/setup-gitversion/lib1.json new file mode 100644 index 0000000..1f02f24 --- /dev/null +++ b/dist/azure/setup-gitversion/lib1.json @@ -0,0 +1,36 @@ +{ + "messages": { + "LIB_UnhandledEx": "Unhandled: %s", + "LIB_FailOnCode": "Failure return code: %d", + "LIB_MkdirFailed": "Unable to create directory '%s'. %s", + "LIB_MkdirFailedFileExists": "Unable to create directory '%s'. Conflicting file exists: '%s'", + "LIB_MkdirFailedInvalidDriveRoot": "Unable to create directory '%s'. Root directory does not exist: '%s'", + "LIB_MkdirFailedInvalidShare": "Unable to create directory '%s'. Unable to verify the directory exists: '%s'. If directory is a file share, please verify the share name is correct, the share is online, and the current process has permission to access the share.", + "LIB_MultilineSecret": "Secrets cannot contain multiple lines", + "LIB_ProcessError": "There was an error when attempting to execute the process '%s'. This may indicate the process failed to start. Error: %s", + "LIB_ProcessExitCode": "The process '%s' failed with exit code %s", + "LIB_ProcessStderr": "The process '%s' failed because one or more lines were written to the STDERR stream", + "LIB_ReturnCode": "Return code: %d", + "LIB_ResourceFileNotExist": "Resource file doesn\\'t exist: %s", + "LIB_ResourceFileAlreadySet": "Resource file has already set to: %s", + "LIB_ResourceFileNotSet": "Resource file haven\\'t set, can\\'t find loc string for key: %s", + "LIB_StdioNotClosed": "The STDIO streams did not close within %s seconds of the exit event from process '%s'. This may indicate a child process inherited the STDIO streams and has not yet exited.", + "LIB_WhichNotFound_Linux": "Unable to locate executable file: '%s'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.", + "LIB_WhichNotFound_Win": "Unable to locate executable file: '%s'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.", + "LIB_LocStringNotFound": "Can\\'t find loc string for key: %s", + "LIB_ParameterIsRequired": "%s not supplied", + "LIB_InputRequired": "Input required: %s", + "LIB_InvalidPattern": "Invalid pattern: '%s'", + "LIB_EndpointNotExist": "Endpoint not present: %s", + "LIB_EndpointDataNotExist": "Endpoint data parameter %s not present: %s", + "LIB_EndpointAuthNotExist": "Endpoint auth data not present: %s", + "LIB_InvalidEndpointAuth": "Invalid endpoint auth: %s", + "LIB_InvalidSecureFilesInput": "Invalid secure file input: %s", + "LIB_PathNotFound": "Not found %s: %s", + "LIB_PathHasNullByte": "Path cannot contain null bytes", + "LIB_OperationFailed": "Failed %s: %s", + "LIB_UseFirstGlobMatch": "Multiple workspace matches. using first.", + "LIB_MergeTestResultNotSupported": "Merging test results from multiple files to one test run is not supported on this version of build agent for OSX/Linux, each test result file will be published as a separate test run in VSO/TFS.", + "LIB_PlatformNotSupported": "Platform not supported: %s" + } +} diff --git a/dist/azure/setup-gitversion/task.json b/dist/azure/setup-gitversion/task.json index 599c6ae..2fda874 100644 --- a/dist/azure/setup-gitversion/task.json +++ b/dist/azure/setup-gitversion/task.json @@ -37,5 +37,5 @@ "required": false, "helpMarkDown": "Include pre-release versions when matching a version" } - ], + ] } \ No newline at end of file diff --git a/dist/azure/update-version.ps1 b/dist/azure/update-version.ps1 new file mode 100644 index 0000000..8cc7900 --- /dev/null +++ b/dist/azure/update-version.ps1 @@ -0,0 +1,38 @@ +function update-task() { + param( + [Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$true)] + [System.String] + $file, + + [Parameter(Mandatory=$True, Position=1, ValueFromPipeline=$false)] + [System.String] + $major, + + [Parameter(Mandatory=$True, Position=2, ValueFromPipeline=$false)] + [System.String] + $minor +) + $file = Resolve-Path $file + $jqMajor = '.version.Major=\"' + $major +'\"'; + $jqMinor = '.version.Minor=\"' + $minor +'\"'; + Write-Host "Update task from $file to version $major.$minor" + + Get-Content $file | jq $jqMajor | jq $jqMinor | Set-Content $file +} + +function update-manifest() { + param( + [Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$true)] + [System.String] + $file, + + [Parameter(Mandatory=$True, Position=1, ValueFromPipeline=$false)] + [System.String] + $version +) + $file = Resolve-Path $file + $jqVersion = '.version=\"' + $version +'\"'; + Write-Host "Update manifest version to $version" + + Get-Content $file | jq $jqVersion | Set-Content $file +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4038604..9e8ac52 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1483,6 +1483,12 @@ "regexp.prototype.flags": "^1.2.0" } }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -2106,6 +2112,17 @@ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "dev": true }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, "fs-write-stream-atomic": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", @@ -3259,6 +3276,33 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "json-update": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/json-update/-/json-update-5.3.0.tgz", + "integrity": "sha512-NUvwm6DMKTVY4raxzAdQiakhD57BKxZwO/7xDYKO10purZiyFK9Gae+fVmAPl0g1WzuwfAJwZzuOcQUavgjE6w==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "fs-extra": "^8.1.0", + "lockfile": "~1.0.4", + "pify": "^4.0.1", + "underscore": "^1.9.2" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "underscore": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.2.tgz", + "integrity": "sha512-D39qtimx0c1fI3ya1Lnhk3E9nONswSKhnffBI0gME9C99fYOkNi04xs8K6pePLhvl1frbDemkaBQ5ikWllR2HQ==", + "dev": true + } + } + }, "json5": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", @@ -3276,6 +3320,15 @@ } } }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, "jszip": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.1.5.tgz", @@ -3389,6 +3442,15 @@ "path-exists": "^3.0.0" } }, + "lockfile": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lockfile/-/lockfile-1.0.4.tgz", + "integrity": "sha512-cvbTwETRfsFh4nHsL1eGWapU1XFi5Ot9E85sWAwia7Y7EgB7vfqcZhTKZ+l7hCGxSPoushMv5GKhT5PdLv03WA==", + "dev": true, + "requires": { + "signal-exit": "^3.0.2" + } + }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", @@ -5478,6 +5540,12 @@ "imurmurhash": "^0.1.4" } }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", diff --git a/package.json b/package.json index c47bf89..d177871 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@types/node": "^13.1.7", "@types/q": "^1.5.2", "@types/uuid": "^3.4.6", + "json-update": "^5.3.0", "reflect-metadata": "^0.1.13", "tfx-cli": "^0.7.11", "ts-loader": "^6.2.1",