Compare commits
104 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bda6b5eba | ||
|
|
edd278e744 | ||
|
|
c7eb02e614 | ||
|
|
6cbe5073c3 | ||
|
|
0e2e93e6aa | ||
|
|
274c9b2e99 | ||
|
|
dab6b01596 | ||
|
|
b98ee9d8b2 | ||
|
|
aba63c943d | ||
|
|
1be05ba386 | ||
|
|
632a7fdad0 | ||
|
|
b677d43869 | ||
|
|
1c5c0557da | ||
|
|
f17101e556 | ||
|
|
7dee6ba225 | ||
|
|
237764149f | ||
|
|
5021e6bca9 | ||
|
|
b541d2f286 | ||
|
|
2e93547963 | ||
|
|
22c25b670a | ||
|
|
32247c8ed9 | ||
|
|
b882929b02 | ||
|
|
18ac32b856 | ||
|
|
57e92d55a3 | ||
|
|
ad52a31bda | ||
|
|
b8df3542ce | ||
|
|
4090f70509 | ||
|
|
5f2a8b7486 | ||
|
|
9a0c41862a | ||
|
|
12398bf4da | ||
|
|
969586f961 | ||
|
|
0df4aab1a8 | ||
|
|
ca2c8097d2 | ||
|
|
300345b152 | ||
|
|
ef8d92d27a | ||
|
|
5e98e2ad3c | ||
|
|
1e937858a2 | ||
|
|
0eae1609b6 | ||
|
|
ee69b451cc | ||
|
|
5ed9f1a870 | ||
|
|
8c92ba9adb | ||
|
|
df7bec89f0 | ||
|
|
b9310160df | ||
|
|
0dc080dece | ||
|
|
e15823128e | ||
|
|
43b2de33fa | ||
|
|
ab48b3cddc | ||
|
|
3f6597b086 | ||
|
|
65b3a90f3f | ||
|
|
88007cb218 | ||
|
|
036fb8fb1d | ||
|
|
019e954030 | ||
|
|
f09d4de93d | ||
|
|
af8f283fe6 | ||
|
|
8e8806b8a9 | ||
|
|
28adff5627 | ||
|
|
6465152ce9 | ||
|
|
bba2ce73bc | ||
|
|
c9f6b4a624 | ||
|
|
8d2218c621 | ||
|
|
c43caa6782 | ||
|
|
bbb232759a | ||
|
|
ba00901a2e | ||
|
|
fea9a70a36 | ||
|
|
64f41a665b | ||
|
|
b1d05d399b | ||
|
|
29d3a7a7ad | ||
|
|
58ad325b1e | ||
|
|
e701a20249 | ||
|
|
643b30de7b | ||
|
|
eb233b1b34 | ||
|
|
dd89dbaaec | ||
|
|
97950ee2f4 | ||
|
|
da49d7514f | ||
|
|
a8aa4e71b8 | ||
|
|
1e3e561d5a | ||
|
|
1860979786 | ||
|
|
b36a13da63 | ||
|
|
77386bb942 | ||
|
|
857ac9a33f | ||
|
|
a445d19ad9 | ||
|
|
216220edaf | ||
|
|
6a5567e664 | ||
|
|
206fc5b464 | ||
|
|
ecabd56a68 | ||
|
|
16e64b0f5a | ||
|
|
b7b390a2ca | ||
|
|
31561bfe18 | ||
|
|
1ebbaf4414 | ||
|
|
c6860ee6ba | ||
|
|
97e28c979f | ||
|
|
f78d4bc5ba | ||
|
|
55452e96e3 | ||
|
|
662586f799 | ||
|
|
3367a76be2 | ||
|
|
40b01fbb2d | ||
|
|
efb7ef8fa1 | ||
|
|
cfab55b468 | ||
|
|
e047d1df94 | ||
|
|
853506e371 | ||
|
|
f2b795f751 | ||
|
|
70a7fbfd27 | ||
|
|
01a1780abe | ||
|
|
4704c3ce45 |
14
.eslintrc.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
plugins: [
|
||||||
|
'@typescript-eslint',
|
||||||
|
'sort-keys-fix'
|
||||||
|
],
|
||||||
|
extends: [
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:@typescript-eslint/eslint-recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'prettier/@typescript-eslint',
|
||||||
|
],
|
||||||
|
};
|
||||||
30
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
name: CI
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [windows-latest, ubuntu-latest, macos-latest]
|
||||||
|
fail-fast: false
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Fetch all history for all tags and branches
|
||||||
|
run: |
|
||||||
|
git fetch --prune --unshallow
|
||||||
|
- run: |
|
||||||
|
npm install
|
||||||
|
npm run build:github
|
||||||
|
npm run build:azure
|
||||||
|
name: Build code
|
||||||
|
- name: Install GitVersion
|
||||||
|
uses: ./gitversion/setup
|
||||||
|
with:
|
||||||
|
versionSpec: '5.1.2'
|
||||||
|
- name: Use GitVersion
|
||||||
|
id: gitversion # step id used as reference for output values
|
||||||
|
uses: ./gitversion/execute
|
||||||
|
- run: |
|
||||||
|
echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
|
||||||
42
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
name: release
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Fetch all history for all tags and branches
|
||||||
|
run: |
|
||||||
|
git fetch --prune --unshallow
|
||||||
|
- run: |
|
||||||
|
npm install
|
||||||
|
npm run build:github
|
||||||
|
npm run build:azure
|
||||||
|
name: Build code
|
||||||
|
- name: Install GitVersion
|
||||||
|
uses: ./gitversion/setup
|
||||||
|
with:
|
||||||
|
versionSpec: '5.1.2'
|
||||||
|
- name: Use GitVersion
|
||||||
|
id: gitversion # step id used as reference for output values
|
||||||
|
uses: ./gitversion/execute
|
||||||
|
- run: |
|
||||||
|
$date = Get-Date -format "yyMMddHHmm"
|
||||||
|
$version = "${{steps.gitversion.outputs.majorMinorPatch}}.$date"
|
||||||
|
$major = "${{steps.gitversion.outputs.major}}"
|
||||||
|
$minor = "${{steps.gitversion.outputs.minor}}"
|
||||||
|
|
||||||
|
. .\dist\azure\update-version.ps1
|
||||||
|
update-manifest .\dist\azure\vss-extension.json -Version $version
|
||||||
|
dir -r .\dist\**\task.json | % { update-task $_ -Major $major -Minor $minor }
|
||||||
|
|
||||||
|
npm run publish:azure -- --token ${{ secrets.TFX_TOKEN }}
|
||||||
|
shell: pwsh
|
||||||
|
name: Publish Azure extension
|
||||||
8
.gitignore
vendored
@@ -1,10 +1,6 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
*.js
|
|
||||||
|
|
||||||
.taskkey
|
.taskkey
|
||||||
|
*.js
|
||||||
dist/azure/task/
|
!dist/**/*.js
|
||||||
!dist/azure/task/icon.png
|
|
||||||
!dist/azure/task/task.json
|
|
||||||
|
|
||||||
*.vsix
|
*.vsix
|
||||||
|
|||||||
56
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "Build-Mock",
|
||||||
|
"name": "Debug Mock Setup GitVersion",
|
||||||
|
"program": "${workspaceFolder}/dist/mock/gitversion/setup/bundle.js",
|
||||||
|
"outFiles": [ "${workspaceFolder}/**/*.js" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "Build-Azure",
|
||||||
|
"name": "Debug Azure Setup GitVersion",
|
||||||
|
"program": "${workspaceFolder}/dist/azure/gitversion/setup/bundle.js",
|
||||||
|
"outFiles": [ "${workspaceFolder}/**/*.js" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "Build-GitHub",
|
||||||
|
"name": "Debug GitHub Setup GitVersion",
|
||||||
|
"program": "${workspaceFolder}/dist/github/gitversion/setup/bundle.js",
|
||||||
|
"outFiles": [ "${workspaceFolder}/**/*.js" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "Build-Mock",
|
||||||
|
"name": "Debug Mock Execute GitVersion",
|
||||||
|
"program": "${workspaceFolder}/dist/mock/gitversion/execute/bundle.js",
|
||||||
|
"outFiles": [ "${workspaceFolder}/**/*.js" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "Build-Azure",
|
||||||
|
"name": "Debug Azure Execute GitVersion",
|
||||||
|
"program": "${workspaceFolder}/dist/azure/gitversion/execute/bundle.js",
|
||||||
|
"outFiles": [ "${workspaceFolder}/**/*.js" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "Build-GitHub",
|
||||||
|
"name": "Debug GitHub Execute GitVersion",
|
||||||
|
"program": "${workspaceFolder}/dist/github/gitversion/execute/bundle.js",
|
||||||
|
"outFiles": [ "${workspaceFolder}/**/*.js" ]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
22
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "Build-Mock",
|
||||||
|
"type": "npm",
|
||||||
|
"script": "build:mock"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Build-Azure",
|
||||||
|
"type": "npm",
|
||||||
|
"script": "build:azure"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Build-GitHub",
|
||||||
|
"type": "npm",
|
||||||
|
"script": "build:github"
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Git Tools
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
91
README.md
@@ -1,2 +1,89 @@
|
|||||||
# use-gitversion
|
# GitTools actions
|
||||||
Github Action that installs and uses the GitVersion tool
|
|
||||||
|

|
||||||
|
|
||||||
|
GitHub Actions that allow to install and use the GitVersion and GitReleaseManager tools
|
||||||
|
|
||||||
|
[](https://github.com/GitTools/actions/actions)
|
||||||
|
[](https://github.com/GitTools/actions/actions)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
See [setup](gitversion/setup/action.yml) and [usage](gitversion/execute/action.yml) for GitVersion
|
||||||
|
|
||||||
|
and [setup](gitreleasemanager/setup/action.yml) for GitReleaseManager
|
||||||
|
|
||||||
|
## Dependency
|
||||||
|
|
||||||
|
There are two step dependencies that are required in your workflow before running this action. You must checkout your Git repository and then fetch the master branch and tags.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Fetch all history for all tags and branches
|
||||||
|
run: git fetch --prune --unshallow
|
||||||
|
```
|
||||||
|
|
||||||
|
Basic:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Fetch all history for all tags and branches
|
||||||
|
run: git fetch --prune --unshallow
|
||||||
|
- name: Install GitVersion
|
||||||
|
uses: gittools/actions/gitversion/setup@v0.6.1
|
||||||
|
with:
|
||||||
|
versionSpec: '5.1.x'
|
||||||
|
- name: Use GitVersion
|
||||||
|
id: gitversion # step id used as reference for output values
|
||||||
|
uses: gittools/actions/gitversion/execute@v0.6.1
|
||||||
|
- run: |
|
||||||
|
echo "Major: ${{ steps.gitversion.outputs.major }}"
|
||||||
|
echo "Minor: ${{ steps.gitversion.outputs.minor }}"
|
||||||
|
echo "Patch: ${{ steps.gitversion.outputs.patch }}"
|
||||||
|
echo "PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }}"
|
||||||
|
echo "PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }}"
|
||||||
|
echo "PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}"
|
||||||
|
echo "PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }}"
|
||||||
|
echo "WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }}"
|
||||||
|
echo "BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}"
|
||||||
|
echo "BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }}"
|
||||||
|
echo "FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }}"
|
||||||
|
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
|
||||||
|
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
|
||||||
|
echo "LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}"
|
||||||
|
echo "LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }}"
|
||||||
|
echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}"
|
||||||
|
echo "AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}"
|
||||||
|
echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
|
||||||
|
echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}"
|
||||||
|
echo "BranchName: ${{ steps.gitversion.outputs.branchName }}"
|
||||||
|
echo "Sha: ${{ steps.gitversion.outputs.sha }}"
|
||||||
|
echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}"
|
||||||
|
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
|
||||||
|
echo "NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}"
|
||||||
|
echo "NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}"
|
||||||
|
echo "NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }}"
|
||||||
|
echo "VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}"
|
||||||
|
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}"
|
||||||
|
echo "CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}"
|
||||||
|
echo "CommitDate: ${{ steps.gitversion.outputs.commitDate }}"
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Private Repositories
|
||||||
|
|
||||||
|
Private repos require credentials before you can fetch the master branch and tags.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Fetch all history for all tags and branches
|
||||||
|
run: |
|
||||||
|
git config remote.origin.url https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
||||||
|
git fetch --prune --unshallow
|
||||||
|
```
|
||||||
|
|||||||
19
action.yml
@@ -1,17 +1,18 @@
|
|||||||
name: use-gitversion
|
name: use-actions
|
||||||
description: GitHub Action for Easy Semantic Versioning with GitVersion. Installs GitVersion and compute the version from git
|
description: GitHub Action for Easy Semantic Versioning with GitVersion. Installs the specific version of GitVersion.Tool
|
||||||
author: GitTools
|
author: GitTools
|
||||||
branding:
|
branding:
|
||||||
color: gray-dark
|
color: gray-dark
|
||||||
icon: git-pull-request
|
icon: git-pull-request
|
||||||
inputs:
|
inputs:
|
||||||
who-to-greet: # id of input
|
versionSpec:
|
||||||
description: 'Who to greet'
|
description: Required version in the form of 5.x or exact version like 5.0.0
|
||||||
required: true
|
required: true
|
||||||
default: 'World'
|
default: ''
|
||||||
outputs:
|
includePrerelease:
|
||||||
time: # id of output
|
description: Include pre-release versions when matching a version
|
||||||
description: 'The time we greeted you'
|
required: false
|
||||||
|
default: false
|
||||||
runs:
|
runs:
|
||||||
using: node12
|
using: node12
|
||||||
main: dist/github/index.js
|
main: dist/github/setup/index.js
|
||||||
|
|||||||
18460
dist/azure/gitreleasemanager/create/bundle.js
vendored
Normal file
BIN
dist/azure/gitreleasemanager/create/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
46
dist/azure/gitreleasemanager/create/lib.json
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"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",
|
||||||
|
"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."
|
||||||
|
}
|
||||||
|
}
|
||||||
95
dist/azure/gitreleasemanager/create/task.json
vendored
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
{
|
||||||
|
"id": "c77d38be-46a9-4ef1-a181-2d6050ed23d2",
|
||||||
|
"name": "gitreleasemanager/create",
|
||||||
|
"friendlyName": "Create GitReleaseManager Task",
|
||||||
|
"description": "Tool for creating and exporting releases for software applications hosted on GitHub",
|
||||||
|
"author": "GitTools Contributors",
|
||||||
|
"helpMarkDown": "See the [documentation](https://gittools.github.io/GitReleaseManager/docs/) for help",
|
||||||
|
"category": "Build",
|
||||||
|
"demands": [],
|
||||||
|
"version": {
|
||||||
|
"Major": "1",
|
||||||
|
"Minor": "0",
|
||||||
|
"Patch": "0"
|
||||||
|
},
|
||||||
|
"minimumAgentVersion": "2.115.0",
|
||||||
|
"execution": {
|
||||||
|
"Node": {
|
||||||
|
"target": "bundle.js",
|
||||||
|
"argumentFormat": "",
|
||||||
|
"workingDirectory": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"instanceNameFormat": "gitreleasemanager/create",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "owner",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The owner of the repository",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": true,
|
||||||
|
"helpMarkDown": "The owner of the repository"
|
||||||
|
}, {
|
||||||
|
"name": "repository",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The name of the repository",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": true,
|
||||||
|
"helpMarkDown": "The name of the repository"
|
||||||
|
}, {
|
||||||
|
"name": "token",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The access token to access GitHub with",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": true,
|
||||||
|
"helpMarkDown": "The access token to access GitHub with"
|
||||||
|
}, {
|
||||||
|
"name": "milestone",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The milestone to use",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "The milestone to use"
|
||||||
|
}, {
|
||||||
|
"name": "name",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The name of the release",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "The name of the release"
|
||||||
|
}, {
|
||||||
|
"name": "inputFilePath",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The path to the file to be used as the content of the release notes",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "The path to the file to be used as the content of the release notes"
|
||||||
|
}, {
|
||||||
|
"name": "pre",
|
||||||
|
"type": "boolean",
|
||||||
|
"label": "Creates the release as a pre-release",
|
||||||
|
"defaultValue": "false",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "Creates the release as a pre-release"
|
||||||
|
}, {
|
||||||
|
"name": "targetcommitish",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The commit to tag. Can be a branch or SHA. Defaults to repository's default branch",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "The commit to tag. Can be a branch or SHA. Defaults to repository's default branch"
|
||||||
|
}, {
|
||||||
|
"name": "targetDirectory",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The directory on which GitReleaseManager should be executed. Defaults to current directory",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "The directory on which GitReleaseManager should be executed. Defaults to current directory"
|
||||||
|
}, {
|
||||||
|
"name": "assets",
|
||||||
|
"type": "multiLine",
|
||||||
|
"label": "Path(s) to the file(s) to include in the release",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "Path(s) to the file(s) to include in the release. Separated by newline"
|
||||||
|
}]
|
||||||
|
}
|
||||||
18460
dist/azure/gitreleasemanager/discard/bundle.js
vendored
Normal file
BIN
dist/azure/gitreleasemanager/discard/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
46
dist/azure/gitreleasemanager/discard/lib.json
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"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",
|
||||||
|
"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."
|
||||||
|
}
|
||||||
|
}
|
||||||
60
dist/azure/gitreleasemanager/discard/task.json
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
"id": "9ae78b66-6100-4522-8106-b7ae00bbfcdf",
|
||||||
|
"name": "gitreleasemanager/discard",
|
||||||
|
"friendlyName": "Discard GitReleaseManager Task",
|
||||||
|
"description": "Tool for creating and exporting releases for software applications hosted on GitHub",
|
||||||
|
"author": "GitTools Contributors",
|
||||||
|
"helpMarkDown": "See the [documentation](https://gittools.github.io/GitReleaseManager/docs/) for help",
|
||||||
|
"category": "Build",
|
||||||
|
"demands": [],
|
||||||
|
"version": {
|
||||||
|
"Major": "1",
|
||||||
|
"Minor": "0",
|
||||||
|
"Patch": "0"
|
||||||
|
},
|
||||||
|
"minimumAgentVersion": "2.115.0",
|
||||||
|
"execution": {
|
||||||
|
"Node": {
|
||||||
|
"target": "bundle.js",
|
||||||
|
"argumentFormat": "",
|
||||||
|
"workingDirectory": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"instanceNameFormat": "gitreleasemanager/discard",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "owner",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The owner of the repository",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": true,
|
||||||
|
"helpMarkDown": "The owner of the repository"
|
||||||
|
}, {
|
||||||
|
"name": "repository",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The name of the repository",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": true,
|
||||||
|
"helpMarkDown": "The name of the repository"
|
||||||
|
}, {
|
||||||
|
"name": "token",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The access token to access GitHub with",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": true,
|
||||||
|
"helpMarkDown": "The access token to access GitHub with"
|
||||||
|
}, {
|
||||||
|
"name": "milestone",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The milestone to use",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": true,
|
||||||
|
"helpMarkDown": "The milestone to use"
|
||||||
|
}, {
|
||||||
|
"name": "targetDirectory",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The directory on which GitReleaseManager should be executed. Defaults to current directory",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "The directory on which GitReleaseManager should be executed. Defaults to current directory"
|
||||||
|
}]
|
||||||
|
}
|
||||||
18460
dist/azure/gitreleasemanager/setup/bundle.js
vendored
Normal file
BIN
dist/azure/gitreleasemanager/setup/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
46
dist/azure/gitreleasemanager/setup/lib.json
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"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",
|
||||||
|
"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."
|
||||||
|
}
|
||||||
|
}
|
||||||
41
dist/azure/gitreleasemanager/setup/task.json
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"id": "e3022448-b00d-4b57-b504-606a0bcf8279",
|
||||||
|
"name": "gitreleasemanager/setup",
|
||||||
|
"friendlyName": "Setup GitReleaseManager Task",
|
||||||
|
"description": "Tool for creating and exporting releases for software applications hosted on GitHub",
|
||||||
|
"author": "GitTools Contributors",
|
||||||
|
"helpMarkDown": "See the [documentation](https://gittools.github.io/GitReleaseManager/docs/) for help",
|
||||||
|
"category": "Build",
|
||||||
|
"demands": [],
|
||||||
|
"version": {
|
||||||
|
"Major": "1",
|
||||||
|
"Minor": "0",
|
||||||
|
"Patch": "0"
|
||||||
|
},
|
||||||
|
"minimumAgentVersion": "2.115.0",
|
||||||
|
"execution": {
|
||||||
|
"Node": {
|
||||||
|
"target": "bundle.js",
|
||||||
|
"argumentFormat": "",
|
||||||
|
"workingDirectory": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"instanceNameFormat": "gitreleasemanager/setup",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "versionSpec",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The version spec",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": true,
|
||||||
|
"helpMarkDown": "Required version in the form of 0.10.x or exact version like 0.10.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "includePrerelease",
|
||||||
|
"type": "boolean",
|
||||||
|
"label": "Include pre-release versions",
|
||||||
|
"defaultValue": "false",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "Include pre-release versions when matching a version"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
18435
dist/azure/gitversion/execute/bundle.js
vendored
Normal file
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
46
dist/azure/gitversion/execute/lib.json
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"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",
|
||||||
|
"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."
|
||||||
|
}
|
||||||
|
}
|
||||||
88
dist/azure/gitversion/execute/task.json
vendored
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"id": "9013cf7f-ee8d-49f4-a39b-db244928d391",
|
||||||
|
"name": "gitversion/execute",
|
||||||
|
"friendlyName": "Execute GitVersion Task",
|
||||||
|
"description": "Easy Semantic Versioning (http://semver.org) for projects using Git",
|
||||||
|
"author": "GitTools Contributors",
|
||||||
|
"helpMarkDown": "See the [documentation](https://gitversion.net/docs/) for help",
|
||||||
|
"category": "Build",
|
||||||
|
"demands": [],
|
||||||
|
"version": {
|
||||||
|
"Major": "1",
|
||||||
|
"Minor": "0",
|
||||||
|
"Patch": "0"
|
||||||
|
},
|
||||||
|
"minimumAgentVersion": "2.115.0",
|
||||||
|
"execution": {
|
||||||
|
"Node": {
|
||||||
|
"target": "bundle.js",
|
||||||
|
"argumentFormat": "",
|
||||||
|
"workingDirectory": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"instanceNameFormat": "gitversion/execute",
|
||||||
|
"groups": [{
|
||||||
|
"name": "gitversionDetails",
|
||||||
|
"displayName": "GitVersion details",
|
||||||
|
"isExpanded": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "additional",
|
||||||
|
"displayName": "Additional Options",
|
||||||
|
"isExpanded": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [{
|
||||||
|
"name": "targetPath",
|
||||||
|
"type": "string",
|
||||||
|
"label": "Working directory path",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "Optionally supply the path to the working directory",
|
||||||
|
"groupName": "gitversionDetails"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "useConfigFile",
|
||||||
|
"type": "boolean",
|
||||||
|
"label": "Specify Configuration file",
|
||||||
|
"defaultValue": "false",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "Whether to use a custom configuration file"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "configFilePath",
|
||||||
|
"type": "filePath",
|
||||||
|
"label": "Configuration file",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "Optional path to config file (defaults to GitVersion.yml)",
|
||||||
|
"visibleRule": "useConfigFile = true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "updateAssemblyInfo",
|
||||||
|
"type": "boolean",
|
||||||
|
"label": "Update AssemblyInfo files",
|
||||||
|
"defaultValue": "false",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "Whether to update versions in the AssemblyInfo files"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "updateAssemblyInfoFilename",
|
||||||
|
"type": "string",
|
||||||
|
"label": "Update Assembly File",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "Update versions in specified file",
|
||||||
|
"visibleRule": "updateAssemblyInfo = true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "additionalArguments",
|
||||||
|
"type": "string",
|
||||||
|
"label": "Additional GitVersion arguments",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "Additional arguments to send to GitVersion",
|
||||||
|
"groupName": "additional"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
18435
dist/azure/gitversion/setup/bundle.js
vendored
Normal file
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
46
dist/azure/gitversion/setup/lib.json
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"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",
|
||||||
|
"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."
|
||||||
|
}
|
||||||
|
}
|
||||||
41
dist/azure/gitversion/setup/task.json
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"id": "a06c02ae-7b9a-4082-90dc-fe27b500e54f",
|
||||||
|
"name": "gitversion/setup",
|
||||||
|
"friendlyName": "Setup GitVersion Task",
|
||||||
|
"description": "Easy Semantic Versioning (http://semver.org) for projects using Git",
|
||||||
|
"author": "GitTools Contributors",
|
||||||
|
"helpMarkDown": "See the [documentation](https://gitversion.net/docs/) for help",
|
||||||
|
"category": "Build",
|
||||||
|
"demands": [],
|
||||||
|
"version": {
|
||||||
|
"Major": "1",
|
||||||
|
"Minor": "0",
|
||||||
|
"Patch": "0"
|
||||||
|
},
|
||||||
|
"minimumAgentVersion": "2.115.0",
|
||||||
|
"execution": {
|
||||||
|
"Node": {
|
||||||
|
"target": "bundle.js",
|
||||||
|
"argumentFormat": "",
|
||||||
|
"workingDirectory": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"instanceNameFormat": "gitversion/setup",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "versionSpec",
|
||||||
|
"type": "string",
|
||||||
|
"label": "The version spec",
|
||||||
|
"defaultValue": "",
|
||||||
|
"required": true,
|
||||||
|
"helpMarkDown": "Required version in the form of 5.x or exact version like 5.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "includePrerelease",
|
||||||
|
"type": "boolean",
|
||||||
|
"label": "Include pre-release versions",
|
||||||
|
"defaultValue": "false",
|
||||||
|
"required": false,
|
||||||
|
"helpMarkDown": "Include pre-release versions when matching a version"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
BIN
dist/azure/images/extension-icon.png
vendored
|
Before Width: | Height: | Size: 4.6 KiB |
BIN
dist/azure/images/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
4
dist/azure/overview.md
vendored
@@ -2,5 +2,5 @@ Versioning when using Git, solved. GitVersion looks at your Git history and work
|
|||||||
|
|
||||||
It works with most branching strategies but has been designed mainly around GitFlow and GitHubFlow (pull request workflow). The calculated version numbers can then be accessed through variables such as `$(GitVersion.NuGetVersion)` and `$(GitVersion.SemVer)`. It is also very configurable to allow it to work with most release workflows!
|
It works with most branching strategies but has been designed mainly around GitFlow and GitHubFlow (pull request workflow). The calculated version numbers can then be accessed through variables such as `$(GitVersion.NuGetVersion)` and `$(GitVersion.SemVer)`. It is also very configurable to allow it to work with most release workflows!
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|||||||
106
dist/azure/task/task.json
vendored
@@ -1,106 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "dd065e3b-6aef-46af-845c-520195836b35",
|
|
||||||
"name": "UseGitVersion",
|
|
||||||
"friendlyName": "GitVersion Task$titleSuffix$",
|
|
||||||
"description": "Easy Semantic Versioning (http://semver.org) for projects using Git",
|
|
||||||
"author": "GitVersion Contributors",
|
|
||||||
"helpMarkDown": "See the [documentation](http://gitversion.readthedocs.org/en/latest/) for help",
|
|
||||||
"category": "Build",
|
|
||||||
"demands": [],
|
|
||||||
"version": {
|
|
||||||
"Major": "5",
|
|
||||||
"Minor": "1",
|
|
||||||
"Patch": "2"
|
|
||||||
},
|
|
||||||
"minimumAgentVersion": "2.115.0",
|
|
||||||
"groups": [
|
|
||||||
{
|
|
||||||
"name": "gitversionDetails",
|
|
||||||
"displayName": "GitVersion details",
|
|
||||||
"isExpanded": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "additional",
|
|
||||||
"displayName": "Additional Options",
|
|
||||||
"isExpanded": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"instanceNameFormat": "GitVersion",
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"name": "versionSpec",
|
|
||||||
"type": "string",
|
|
||||||
"label": "The version spec",
|
|
||||||
"defaultValue": "",
|
|
||||||
"required": true,
|
|
||||||
"helpMarkDown": "Required version in the form of 5.x or exact version like 5.0.0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "includePrerelease",
|
|
||||||
"type": "boolean",
|
|
||||||
"label": "Include pre-release versions",
|
|
||||||
"defaultValue": "false",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Include pre-release versions when matching a version"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "targetPath",
|
|
||||||
"type": "string",
|
|
||||||
"label": "Working directory path",
|
|
||||||
"defaultValue": "",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Optionally supply the path to the working directory",
|
|
||||||
"groupName": "gitversionDetails"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "useConfigFile",
|
|
||||||
"type": "boolean",
|
|
||||||
"label": "Specify Configuration file",
|
|
||||||
"defaultValue": "false",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Whether to use a custom configuration file"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "configFilePath",
|
|
||||||
"type": "filePath",
|
|
||||||
"label": "Configuration file",
|
|
||||||
"defaultValue": "",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Optional path to config file (defaults to GitVersion.yml)",
|
|
||||||
"visibleRule": "useConfigFile = true"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "updateAssemblyInfo",
|
|
||||||
"type": "boolean",
|
|
||||||
"label": "Update AssemblyInfo files",
|
|
||||||
"defaultValue": "false",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Whether to update versions in the AssemblyInfo files"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "updateAssemblyInfoFilename",
|
|
||||||
"type": "string",
|
|
||||||
"label": "Update Assembly File",
|
|
||||||
"defaultValue": "",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Update versions in specified file",
|
|
||||||
"visibleRule": "updateAssemblyInfo = true"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "additionalArguments",
|
|
||||||
"type": "string",
|
|
||||||
"label": "Additional GitVersion arguments",
|
|
||||||
"defaultValue": "",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Additional arguments to send to GitVersion",
|
|
||||||
"groupName": "additional"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"execution": {
|
|
||||||
"Node": {
|
|
||||||
"target": "GitVersion.js",
|
|
||||||
"argumentFormat": "",
|
|
||||||
"workingDirectory": "."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
38
dist/azure/update-version.ps1
vendored
Normal file
@@ -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
|
||||||
|
}
|
||||||
70
dist/azure/vss-extension.json
vendored
@@ -1,26 +1,30 @@
|
|||||||
{
|
{
|
||||||
"manifestVersion": 1,
|
"manifestVersion": 1,
|
||||||
"id": "usegitversion$idSuffix$",
|
"id": "gittools",
|
||||||
"name": "UseGitVersion$titleSuffix$",
|
"name": "GitTools",
|
||||||
|
"version": "0.0.1",
|
||||||
"publisher": "gittools",
|
"publisher": "gittools",
|
||||||
"public": true,
|
"public": true,
|
||||||
"author": "GitVersion Contributors",
|
"author": "GitTools Contributors",
|
||||||
"version": "$version$",
|
"description": "Build tasks for easy semantic versioning for projects using Git and release management.",
|
||||||
"description": "Build task for easy semantic versioning for projects using Git.",
|
|
||||||
"targets": [{
|
"targets": [{
|
||||||
"id": "Microsoft.VisualStudio.Services"
|
"id": "Microsoft.VisualStudio.Services"
|
||||||
}],
|
}],
|
||||||
"files": [
|
"files": [
|
||||||
{ "path": "task" }
|
{ "path": "gitversion/setup" },
|
||||||
|
{ "path": "gitversion/execute" },
|
||||||
|
{ "path": "gitreleasemanager/setup" },
|
||||||
|
{ "path": "gitreleasemanager/create" },
|
||||||
|
{ "path": "gitreleasemanager/discard" }
|
||||||
],
|
],
|
||||||
"categories": [
|
"categories": [
|
||||||
"Azure Pipelines"
|
"Azure Pipelines"
|
||||||
],
|
],
|
||||||
"galleryFlags": [
|
"galleryFlags": [
|
||||||
"$visibility$"
|
"Public"
|
||||||
],
|
],
|
||||||
"icons": {
|
"icons": {
|
||||||
"default": "images/extension-icon.png"
|
"default": "images/icon.png"
|
||||||
},
|
},
|
||||||
"tags": [
|
"tags": [
|
||||||
"semver",
|
"semver",
|
||||||
@@ -31,19 +35,19 @@
|
|||||||
],
|
],
|
||||||
"links": {
|
"links": {
|
||||||
"learn": {
|
"learn": {
|
||||||
"uri": "http://gitversion.readthedocs.org/en/stable"
|
"uri": "https://github.com/GitTools/actions"
|
||||||
},
|
},
|
||||||
"getstarted": {
|
"getstarted": {
|
||||||
"uri": "http://gitversion.readthedocs.org/en/stable/build-server-support/build-server/tfs-build-vnext/#running-inside-tfs"
|
"uri": "https://github.com/GitTools/actions"
|
||||||
},
|
},
|
||||||
"license": {
|
"license": {
|
||||||
"uri": "https://github.com/GitTools/GitVersion/blob/master/LICENSE"
|
"uri": "https://github.com/GitTools/actions/blob/master/LICENSE"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"uri": "https://github.com/GitTools/GitVersion"
|
"uri": "https://github.com/GitTools/actions.git"
|
||||||
},
|
},
|
||||||
"support": {
|
"support": {
|
||||||
"uri": "https://github.com/GitTools/GitVersion/issues"
|
"uri": "https://github.com/GitTools/actions/issues"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"screenshots": [{
|
"screenshots": [{
|
||||||
@@ -59,13 +63,49 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"contributions": [{
|
"contributions": [{
|
||||||
"id": "gitversion-task",
|
"id": "setup-gitversion-task",
|
||||||
"type": "ms.vss-distributed-task.task",
|
"type": "ms.vss-distributed-task.task",
|
||||||
"targets": [
|
"targets": [
|
||||||
"ms.vss-distributed-task.tasks"
|
"ms.vss-distributed-task.tasks"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": "GitVersionTask"
|
"name": "gitversion/setup"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"id": "execute-gitversion-task",
|
||||||
|
"type": "ms.vss-distributed-task.task",
|
||||||
|
"targets": [
|
||||||
|
"ms.vss-distributed-task.tasks"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"name": "gitversion/execute"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"id": "setup-gitreleasemanager-task",
|
||||||
|
"type": "ms.vss-distributed-task.task",
|
||||||
|
"targets": [
|
||||||
|
"ms.vss-distributed-task.tasks"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"name": "gitreleasemanager/setup"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"id": "create-gitreleasemanager-task",
|
||||||
|
"type": "ms.vss-distributed-task.task",
|
||||||
|
"targets": [
|
||||||
|
"ms.vss-distributed-task.tasks"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"name": "gitreleasemanager/create"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"id": "discard-gitreleasemanager-task",
|
||||||
|
"type": "ms.vss-distributed-task.task",
|
||||||
|
"targets": [
|
||||||
|
"ms.vss-distributed-task.tasks"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"name": "gitreleasemanager/discard"
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
12504
dist/github/gitreleasemanager/create/bundle.js
vendored
Normal file
12504
dist/github/gitreleasemanager/discard/bundle.js
vendored
Normal file
12504
dist/github/gitreleasemanager/setup/bundle.js
vendored
Normal file
12479
dist/github/gitversion/execute/bundle.js
vendored
Normal file
12479
dist/github/gitversion/setup/bundle.js
vendored
Normal file
4677
dist/github/index.js
vendored
7865
dist/mock/gitreleasemanager/create/bundle.js
vendored
Normal file
7865
dist/mock/gitreleasemanager/discard/bundle.js
vendored
Normal file
7865
dist/mock/gitreleasemanager/setup/bundle.js
vendored
Normal file
7840
dist/mock/gitversion/execute/bundle.js
vendored
Normal file
7840
dist/mock/gitversion/setup/bundle.js
vendored
Normal file
BIN
docs/icon.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
46
gitreleasemanager/create/action.yml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
name: gitreleasemanager-create
|
||||||
|
description: GitHub Action for creating and exporting releases for software applications hosted on GitHub. Creates the release
|
||||||
|
author: GitTools
|
||||||
|
branding:
|
||||||
|
color: gray-dark
|
||||||
|
icon: git-pull-request
|
||||||
|
runs:
|
||||||
|
using: node12
|
||||||
|
main: ../../dist/github/gitreleasemanager/create/bundle.js
|
||||||
|
inputs:
|
||||||
|
owner:
|
||||||
|
description: The owner of the repository
|
||||||
|
required: true
|
||||||
|
default: ''
|
||||||
|
repository:
|
||||||
|
description: The name of the repository
|
||||||
|
required: true
|
||||||
|
default: ''
|
||||||
|
token:
|
||||||
|
description: The access token to access GitHub with
|
||||||
|
required: true
|
||||||
|
default: ''
|
||||||
|
milestone:
|
||||||
|
description: The milestone to use
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
name:
|
||||||
|
description: The name of the release
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
inputFilePath:
|
||||||
|
description: The path to the file to be used as the content of the release notes
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
pre:
|
||||||
|
description: Creates the release as a pre-release
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
|
targetcommitish:
|
||||||
|
description: The commit to tag. Can be a branch or SHA. Defaults to repository's default branch
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
targetDirectory:
|
||||||
|
description: The directory on which GitReleaseManager should be executed. Defaults to current directory
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
30
gitreleasemanager/discard/action.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
name: gitreleasemanager-discard
|
||||||
|
description: GitHub Action for creating and exporting releases for software applications hosted on GitHub. Discards a release
|
||||||
|
author: GitTools
|
||||||
|
branding:
|
||||||
|
color: gray-dark
|
||||||
|
icon: git-pull-request
|
||||||
|
runs:
|
||||||
|
using: node12
|
||||||
|
main: ../../dist/github/gitreleasemanager/discard/bundle.js
|
||||||
|
inputs:
|
||||||
|
owner:
|
||||||
|
description: The owner of the repository
|
||||||
|
required: true
|
||||||
|
default: ''
|
||||||
|
repository:
|
||||||
|
description: The name of the repository
|
||||||
|
required: true
|
||||||
|
default: ''
|
||||||
|
token:
|
||||||
|
description: The access token to access GitHub with
|
||||||
|
required: true
|
||||||
|
default: ''
|
||||||
|
milestone:
|
||||||
|
description: The milestone to use
|
||||||
|
required: true
|
||||||
|
default: ''
|
||||||
|
targetDirectory:
|
||||||
|
description: The directory on which GitReleaseManager should be executed. Defaults to current directory
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
18
gitreleasemanager/setup/action.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
name: gitreleasemanager-setup
|
||||||
|
description: GitHub Action for creating and exporting releases for software applications hosted on GitHub. Installs the specific version of GitReleaseManager.Tool
|
||||||
|
author: GitTools
|
||||||
|
branding:
|
||||||
|
color: gray-dark
|
||||||
|
icon: git-pull-request
|
||||||
|
runs:
|
||||||
|
using: node12
|
||||||
|
main: ../../dist/github/gitreleasemanager/setup/bundle.js
|
||||||
|
inputs:
|
||||||
|
versionSpec:
|
||||||
|
description: Required version in the form of 0.10.x or exact version like 0.10.2
|
||||||
|
required: true
|
||||||
|
default: ''
|
||||||
|
includePrerelease:
|
||||||
|
description: Include pre-release versions when matching a version
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
95
gitversion/execute/action.yml
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
name: gitversion-execute
|
||||||
|
description: GitHub Action for Easy Semantic Versioning with GitVersion. Execute GitVersion to obtain version information
|
||||||
|
author: GitTools
|
||||||
|
branding:
|
||||||
|
color: gray-dark
|
||||||
|
icon: git-pull-request
|
||||||
|
runs:
|
||||||
|
using: node12
|
||||||
|
main: ../../dist/github/gitversion/execute/bundle.js
|
||||||
|
inputs:
|
||||||
|
targetPath:
|
||||||
|
description: Optionally supply the path to the working directory
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
useConfigFile:
|
||||||
|
description: Whether to use a custom configuration file
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
|
configFilePath:
|
||||||
|
description: Optional path to config file (defaults to GitVersion.yml)
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
updateAssemblyInfo:
|
||||||
|
description: Whether to update versions in the AssemblyInfo files
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
|
updateAssemblyInfoFilename:
|
||||||
|
description: Update versions in specified file
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
additionalArguments:
|
||||||
|
description: Additional arguments to send to GitVersion
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
outputs:
|
||||||
|
major: # id of output
|
||||||
|
description: 'The Major value'
|
||||||
|
minor:
|
||||||
|
description: 'The Minor value'
|
||||||
|
patch:
|
||||||
|
description: 'The Patch value'
|
||||||
|
preReleaseTag:
|
||||||
|
description: 'The PreReleaseTag value'
|
||||||
|
preReleaseTagWithDash:
|
||||||
|
description: 'The PreReleaseTagWithDash value'
|
||||||
|
preReleaseLabel:
|
||||||
|
description: 'The PreReleaseLabel value'
|
||||||
|
preReleaseNumber:
|
||||||
|
description: 'The PreReleaseNumber value'
|
||||||
|
weightedPreReleaseNumber:
|
||||||
|
description: 'The WeightedPreReleaseNumber value'
|
||||||
|
buildMetaData:
|
||||||
|
description: 'The BuildMetaData value'
|
||||||
|
buildMetaDataPadded:
|
||||||
|
description: 'The BuildMetaDataPadded value'
|
||||||
|
fullBuildMetaData:
|
||||||
|
description: 'The FullBuildMetaData value'
|
||||||
|
majorMinorPatch:
|
||||||
|
description: 'The MajorMinorPatch value'
|
||||||
|
semVer:
|
||||||
|
description: 'The SemVer value'
|
||||||
|
legacySemVer:
|
||||||
|
description: 'The LegacySemVer value'
|
||||||
|
legacySemVerPadded:
|
||||||
|
description: 'The LegacySemVerPadded value'
|
||||||
|
assemblySemVer:
|
||||||
|
description: 'The AssemblySemVer value'
|
||||||
|
assemblySemFileVer:
|
||||||
|
description: 'The AssemblySemFileVer value'
|
||||||
|
fullSemVer:
|
||||||
|
description: 'The FullSemVer value'
|
||||||
|
informationalVersion:
|
||||||
|
description: 'The InformationalVersion value'
|
||||||
|
branchName:
|
||||||
|
description: 'The BranchName value'
|
||||||
|
sha:
|
||||||
|
description: 'The Sha value'
|
||||||
|
shortSha:
|
||||||
|
description: 'The ShortSha value'
|
||||||
|
nuGetVersionV2:
|
||||||
|
description: 'The NuGetVersionV2 value'
|
||||||
|
nuGetVersion:
|
||||||
|
description: 'The NuGetVersion value'
|
||||||
|
nuGetPreReleaseTagV2:
|
||||||
|
description: 'The NuGetPreReleaseTagV2 value'
|
||||||
|
nuGetPreReleaseTag:
|
||||||
|
description: 'The NuGetPreReleaseTag value'
|
||||||
|
versionSourceSha:
|
||||||
|
description: 'The VersionSourceSha value'
|
||||||
|
commitsSinceVersionSource:
|
||||||
|
description: 'The CommitsSinceVersionSource value'
|
||||||
|
commitsSinceVersionSourcePadded:
|
||||||
|
description: 'The CommitsSinceVersionSourcePadded value'
|
||||||
|
commitDate:
|
||||||
|
description: 'The CommitDate value'
|
||||||
18
gitversion/setup/action.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
name: gitversion-setup
|
||||||
|
description: GitHub Action for Easy Semantic Versioning with GitVersion. Installs the specific version of GitVersion.Tool
|
||||||
|
author: GitTools
|
||||||
|
branding:
|
||||||
|
color: gray-dark
|
||||||
|
icon: git-pull-request
|
||||||
|
runs:
|
||||||
|
using: node12
|
||||||
|
main: ../../dist/github/gitversion/setup/bundle.js
|
||||||
|
inputs:
|
||||||
|
versionSpec:
|
||||||
|
description: Required version in the form of 5.x or exact version like 5.0.0
|
||||||
|
required: true
|
||||||
|
default: ''
|
||||||
|
includePrerelease:
|
||||||
|
description: Include pre-release versions when matching a version
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
8713
package-lock.json
generated
77
package.json
@@ -1,49 +1,52 @@
|
|||||||
{
|
{
|
||||||
"name": "use-gitversion",
|
"name": "gittools-actions",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Github Action that installs and uses the GitVersion tool",
|
"description": "Easy Semantic Versioning (http://semver.org) for projects using Git",
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"build-github": "tsc -p src/github",
|
|
||||||
"build-azure": "tsc -p src/azure && tsc -p src/azure/tests",
|
|
||||||
"test-azure": "mocha src/azure/tests/test-suite.js",
|
|
||||||
"package-github": "ncc build src/github/GitVersion.js -o dist/github",
|
|
||||||
"package-azure": "ncc build src/github/GitVersion.js -o dist/azure/task && tfx extension create --root dist/azure --manifest-globs vss-extension.json --output-path dist/azure"
|
|
||||||
},
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/GitTools/use-gitversion.git"
|
"url": "https://github.com/GitTools/use-gitversion.git"
|
||||||
|
},
|
||||||
|
"main": "main.js",
|
||||||
|
"scripts": {
|
||||||
|
"build:mock": "webpack --config webpack.config.js --env.agent=mock",
|
||||||
|
"build:azure": "webpack --config webpack.config.js --env.agent=azure",
|
||||||
|
"build:github": "webpack --config webpack.config.js --env.agent=github",
|
||||||
|
"build:mock:prod": "npm run build:mock -- --env.mode=production",
|
||||||
|
"build:azure:prod": "npm run build:azure -- --env.mode=production",
|
||||||
|
"build:github:prod": "npm run build:github -- --env.mode=production",
|
||||||
|
"build": "npm run build:mock && npm run build:azure && npm run build:github",
|
||||||
|
"build:prod": "npm run build:mock:prod && npm run build:azure:prod && npm run build:github:prod",
|
||||||
|
"publish:azure": "tfx extension publish --root ./dist/azure --no-wait-validation --auth-type pat"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
|
||||||
"author": "GitTools",
|
"author": "GitTools",
|
||||||
|
"contributors": [
|
||||||
|
"GitTools contributors"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/GitTools/use-gitversion/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/GitTools/use-gitversion#readme",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.0",
|
"@actions/core": "^1.2.2",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.3",
|
||||||
"@actions/io": "^1.0.1",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^1.1.2",
|
"@actions/tool-cache": "^1.3.1",
|
||||||
"azure-pipelines-task-lib": "2.8.0",
|
"azure-pipelines-task-lib": "^2.9.3",
|
||||||
"azure-pipelines-tool-lib": "0.12.0",
|
"azure-pipelines-tool-lib": "^0.12.0",
|
||||||
"semver": "^6.3.0",
|
"inversify": "^5.0.1",
|
||||||
"semver-compare": "^1.0.0",
|
"typed-rest-client": "^1.7.1",
|
||||||
"typed-rest-client": "1.5.0",
|
"uuid": "^3.4.0"
|
||||||
"uuid": "^3.3.3"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/node": "^13.7.0",
|
||||||
"@types/node": "^12.12.7",
|
"@types/q": "^1.5.2",
|
||||||
"@types/q": "1.5.2",
|
"@types/semver-compare": "^1.0.1",
|
||||||
"@types/semver": "^6.2.0",
|
"@types/uuid": "^3.4.7",
|
||||||
"@types/uuid": "^3.4.6",
|
"json-update": "^5.3.0",
|
||||||
"@zeit/ncc": "^0.20.5",
|
"reflect-metadata": "^0.1.13",
|
||||||
"copy-node-modules": "^1.1.1",
|
"replace-in-file-webpack-plugin": "^1.0.6",
|
||||||
"mocha": "^6.2.1",
|
"tfx-cli": "^0.7.11",
|
||||||
"mocha-xunit-reporter": "^1.1.0",
|
"ts-loader": "^6.2.1",
|
||||||
"tfx-cli": "0.6.3",
|
"tslint": "^6.0.0",
|
||||||
"typescript": "^3.7.2"
|
"typescript": "^3.7.5",
|
||||||
|
"webpack": "^4.41.5",
|
||||||
|
"webpack-cli": "^3.3.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
export interface IProxy {
|
|
||||||
find: (toolName: string, versionSpec: string, arch?: string) => string;
|
|
||||||
debug: (message: string) => void;
|
|
||||||
exportVariable: (name: string, val: string) => void;
|
|
||||||
addPath: (inputPath: string) => void;
|
|
||||||
which: (tool: string, check?: boolean) => Promise<string>;
|
|
||||||
cacheDir: (sourceDir: string, tool: string, version: string, arch?: string) => Promise<string>;
|
|
||||||
isExplicitVersion: (versionSpec: string) => boolean;
|
|
||||||
evaluateVersions: (versions: string[], versionSpec: string) => string;
|
|
||||||
cleanVersion: (version: string) => string;
|
|
||||||
createTempDir: () => Promise<string>;
|
|
||||||
executeDotNet: (args: string[]) => Promise<IExecSyncResult>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface IExecSyncResult {
|
|
||||||
/** standard output */
|
|
||||||
stdout: string;
|
|
||||||
/** error output */
|
|
||||||
stderr: string;
|
|
||||||
/** return code */
|
|
||||||
code: number;
|
|
||||||
/** Error on failure */
|
|
||||||
error: Error;
|
|
||||||
}
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
import * as fs from 'fs';
|
|
||||||
import * as os from 'os';
|
|
||||||
import * as path from 'path';
|
|
||||||
|
|
||||||
import * as httpm from 'typed-rest-client/HttpClient';
|
|
||||||
|
|
||||||
import { IProxy } from './Interfaces';
|
|
||||||
|
|
||||||
export class ToolInstaller {
|
|
||||||
constructor(public utils: IProxy) {
|
|
||||||
this.httpClient = new httpm.HttpClient("ToolInstaller");
|
|
||||||
}
|
|
||||||
|
|
||||||
public async downloadAndInstall(toolName: string, versionSpec: string, checkLatest: boolean, includePrerelease: boolean): Promise<string> {
|
|
||||||
console.log('');
|
|
||||||
console.log('--------------------------');
|
|
||||||
console.log(`Installing ${toolName} version ` + versionSpec);
|
|
||||||
console.log('--------------------------');
|
|
||||||
|
|
||||||
if (this.utils.isExplicitVersion(versionSpec)) {
|
|
||||||
checkLatest = false; // check latest doesn't make sense when explicit version
|
|
||||||
}
|
|
||||||
|
|
||||||
let toolPath: string;
|
|
||||||
if (!checkLatest) {
|
|
||||||
//
|
|
||||||
// Let's try and resolve the version spec locally first
|
|
||||||
//
|
|
||||||
toolPath = this.utils.find(toolName, versionSpec);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!toolPath) {
|
|
||||||
let version: string;
|
|
||||||
if (this.utils.isExplicitVersion(versionSpec)) {
|
|
||||||
//
|
|
||||||
// Explicit version was specified. No need to query for list of versions.
|
|
||||||
//
|
|
||||||
version = versionSpec;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//
|
|
||||||
// Let's query and resolve the latest version for the versionSpec.
|
|
||||||
// If the version is an explicit version (1.1.1 or v1.1.1) then no need to query.
|
|
||||||
// If your tool doesn't offer a mechanism to query,
|
|
||||||
// then it can only support exact version inputs.
|
|
||||||
//
|
|
||||||
version = await this.queryLatestMatch(toolName, versionSpec, includePrerelease);
|
|
||||||
if (!version) {
|
|
||||||
throw new Error(`Unable to find ${toolName} version '${versionSpec}'.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check the cache for the resolved version.
|
|
||||||
//
|
|
||||||
toolPath = this.utils.find(toolName, version)
|
|
||||||
}
|
|
||||||
if (!toolPath) {
|
|
||||||
//
|
|
||||||
// Download, extract, cache
|
|
||||||
//
|
|
||||||
toolPath = await this.acquireTool(toolName, version);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Prepend the tools path. This prepends the PATH for the current process and
|
|
||||||
// instructs the agent to prepend for each task that follows.
|
|
||||||
//
|
|
||||||
this.utils.debug(`toolPath: ${toolPath}`);
|
|
||||||
|
|
||||||
if (os.platform() != 'win32') {
|
|
||||||
let dotnetRoot = path.dirname(fs.readlinkSync(await this.utils.which("dotnet")));
|
|
||||||
this.utils.exportVariable('DOTNET_ROOT', dotnetRoot);
|
|
||||||
}
|
|
||||||
this.utils.addPath(toolPath);
|
|
||||||
|
|
||||||
return toolPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async queryLatestMatch(toolName: string, versionSpec: string, includePrerelease: boolean): Promise<string> {
|
|
||||||
this.utils.debug(`querying tool versions for ${toolName}${versionSpec ? `@${versionSpec}` : ""} ${includePrerelease ? "including pre-releases" : ""}`);
|
|
||||||
|
|
||||||
var downloadPath = `https://api-v2v3search-0.nuget.org/query?q=${encodeURIComponent(toolName.toLowerCase())}&prerelease=${includePrerelease ? "true" : "false"}&semVerLevel=2.0.0`;
|
|
||||||
var res = await this.httpClient.get(downloadPath);
|
|
||||||
|
|
||||||
if (!res || res.message.statusCode != 200)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
let body: string = await res.readBody();
|
|
||||||
var data = JSON.parse(body).data;
|
|
||||||
|
|
||||||
const versions = (<Array<{ version: string }>>data[0].versions).map(x => x.version);
|
|
||||||
if (!versions || !versions.length)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.utils.debug(`got versions: ${versions.join(", ")}`);
|
|
||||||
|
|
||||||
return this.utils.evaluateVersions(versions, versionSpec);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async acquireTool(toolName: string, version: string): Promise<string> {
|
|
||||||
|
|
||||||
let tempDirectory = await this.utils.createTempDir();
|
|
||||||
let args = ["tool", "install", toolName, "--tool-path", tempDirectory];
|
|
||||||
|
|
||||||
if (version) {
|
|
||||||
version = this.utils.cleanVersion(version);
|
|
||||||
args = args.concat(["--version", version]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let result = await this.utils.executeDotNet(args);
|
|
||||||
let status = result.code === 0 ? "success" : "failure";
|
|
||||||
let message = result.code === 0 ? result.stdout : result.stderr;
|
|
||||||
|
|
||||||
this.utils.debug(`tool install result: ${status} ${message}`);
|
|
||||||
|
|
||||||
if (result.code) {
|
|
||||||
throw new Error("Error installing tool");
|
|
||||||
}
|
|
||||||
|
|
||||||
return await this.utils.cacheDir(tempDirectory, toolName, version);
|
|
||||||
}
|
|
||||||
|
|
||||||
private httpClient: httpm.HttpClient;
|
|
||||||
}
|
|
||||||
106
src/agent/azure/build-agent.ts
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import { injectable } from "inversify";
|
||||||
|
|
||||||
|
import * as taskLib from "azure-pipelines-task-lib/task";
|
||||||
|
import * as toolLib from "azure-pipelines-tool-lib/tool";
|
||||||
|
|
||||||
|
import { IBuildAgent, IExecResult } from "../../core/models";
|
||||||
|
|
||||||
|
@injectable()
|
||||||
|
class BuildAgent implements IBuildAgent {
|
||||||
|
|
||||||
|
public get agentName(): string {
|
||||||
|
return "Azure Pipelines";
|
||||||
|
}
|
||||||
|
|
||||||
|
public find(toolName: string, versionSpec: string, arch?: string): string {
|
||||||
|
return toolLib.findLocalTool(toolName, versionSpec, arch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string> {
|
||||||
|
return toolLib.cacheDir(sourceDir, tool, version, arch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public createTempDir(): Promise<string> {
|
||||||
|
return Promise.resolve(taskLib.getVariable("Agent.TempDirectory"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public debug(message: string): void {
|
||||||
|
taskLib.debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public setFailed(message: string, done?: boolean): void {
|
||||||
|
taskLib.setResult(taskLib.TaskResult.Failed, message, done);
|
||||||
|
}
|
||||||
|
|
||||||
|
public setSucceeded(message: string, done?: boolean): void {
|
||||||
|
taskLib.setResult(taskLib.TaskResult.Succeeded, message, done);
|
||||||
|
}
|
||||||
|
|
||||||
|
public exportVariable(name: string, val: string): void {
|
||||||
|
taskLib.setVariable(name, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getVariable(name: string): string {
|
||||||
|
return taskLib.getVariable(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public addPath(inputPath: string): void {
|
||||||
|
toolLib.prependPath(inputPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public which(tool: string, check?: boolean): Promise<string> {
|
||||||
|
return Promise.resolve(taskLib.which(tool, check));
|
||||||
|
}
|
||||||
|
|
||||||
|
public exec(exec: string, args: string[]): Promise<IExecResult> {
|
||||||
|
const tr = taskLib.tool(exec);
|
||||||
|
tr.arg(args);
|
||||||
|
|
||||||
|
const result = tr.execSync();
|
||||||
|
return Promise.resolve({
|
||||||
|
code: result.code,
|
||||||
|
error: result.error,
|
||||||
|
stderr: result.stderr,
|
||||||
|
stdout: result.stdout,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public getSourceDir(): string {
|
||||||
|
return this.getVariable("Build.SourcesDirectory");
|
||||||
|
}
|
||||||
|
|
||||||
|
public setOutput(name: string, value: string): void {
|
||||||
|
taskLib.setVariable(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getInput(input: string, required?: boolean): string {
|
||||||
|
return taskLib.getInput(input, required);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getListInput(input: string, required?: boolean): string[] {
|
||||||
|
return taskLib
|
||||||
|
.getInput(input, required)
|
||||||
|
.split("\n")
|
||||||
|
.filter(x => x !== "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public getBooleanInput(input: string, required?: boolean): boolean {
|
||||||
|
return taskLib.getBoolInput(input, required);
|
||||||
|
}
|
||||||
|
|
||||||
|
public isValidInputFile(input: string, file: string): boolean {
|
||||||
|
return taskLib.filePathSupplied(input) && this.fileExists(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public fileExists(file: string): boolean {
|
||||||
|
return taskLib.exist(file) && taskLib.stats(file).isFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public directoryExists(file: string): boolean {
|
||||||
|
return taskLib.exist(file) && taskLib.stats(file).isDirectory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
BuildAgent,
|
||||||
|
};
|
||||||
171
src/agent/github/build-agent.ts
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
import * as fs from "fs";
|
||||||
|
import * as path from "path";
|
||||||
|
|
||||||
|
import uuidv4 from "uuid";
|
||||||
|
|
||||||
|
import * as core from "@actions/core";
|
||||||
|
import * as exe from "@actions/exec";
|
||||||
|
import * as io from "@actions/io";
|
||||||
|
import * as toolCache from "@actions/tool-cache";
|
||||||
|
|
||||||
|
import { injectable } from "inversify";
|
||||||
|
|
||||||
|
import { IBuildAgent, IExecResult } from "../../core/models";
|
||||||
|
|
||||||
|
@injectable()
|
||||||
|
class BuildAgent implements IBuildAgent {
|
||||||
|
|
||||||
|
public get agentName(): string {
|
||||||
|
return "GitHub Actions";
|
||||||
|
}
|
||||||
|
|
||||||
|
public find(toolName: string, versionSpec: string, arch?: string): string {
|
||||||
|
return toolCache.find(toolName, versionSpec, arch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string> {
|
||||||
|
return toolCache.cacheDir(sourceDir, tool, version, arch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async createTempDir(): Promise<string> {
|
||||||
|
const IS_WINDOWS = process.platform === "win32";
|
||||||
|
|
||||||
|
let tempDirectory: string = process.env.RUNNER_TEMP || "";
|
||||||
|
|
||||||
|
if (!tempDirectory) {
|
||||||
|
let baseLocation: string;
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
// On Windows use the USERPROFILE env variable
|
||||||
|
baseLocation = process.env.USERPROFILE || "C:\\";
|
||||||
|
} else {
|
||||||
|
if (process.platform === "darwin") {
|
||||||
|
baseLocation = "/Users";
|
||||||
|
} else {
|
||||||
|
baseLocation = "/home";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tempDirectory = path.join(baseLocation, "actions", "temp");
|
||||||
|
}
|
||||||
|
const dest = path.join(tempDirectory, uuidv4());
|
||||||
|
await io.mkdirP(dest);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public debug(message: string): void {
|
||||||
|
core.debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public setFailed(message: string, done?: boolean): void {
|
||||||
|
core.setFailed(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public setSucceeded(message: string, done?: boolean): void {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public exportVariable(name: string, val: string): void {
|
||||||
|
core.exportVariable(name, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getVariable(name: string): string {
|
||||||
|
return process.env[name];
|
||||||
|
}
|
||||||
|
|
||||||
|
public addPath(inputPath: string): void {
|
||||||
|
core.addPath(inputPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public which(tool: string, check?: boolean): Promise<string> {
|
||||||
|
return io.which(tool, check);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async exec(exec: string, args: string[]): Promise<IExecResult> {
|
||||||
|
const dotnetPath = await io.which(exec, true);
|
||||||
|
let resultCode = 0;
|
||||||
|
let stdout = "";
|
||||||
|
let stderr = "";
|
||||||
|
resultCode = await exe.exec(
|
||||||
|
`"${dotnetPath}"`,
|
||||||
|
args,
|
||||||
|
{
|
||||||
|
listeners: {
|
||||||
|
stderr: (data: Buffer) => {
|
||||||
|
stderr += data.toString();
|
||||||
|
},
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
stdout += data.toString();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
code: resultCode,
|
||||||
|
error: null,
|
||||||
|
stderr,
|
||||||
|
stdout,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public getSourceDir(): string {
|
||||||
|
return this.getVariable("GITHUB_WORKSPACE");
|
||||||
|
}
|
||||||
|
|
||||||
|
public setOutput(name: string, value: string): void {
|
||||||
|
core.setOutput(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getInput(input: string, required?: boolean): string {
|
||||||
|
return core.getInput(input, { required } as core.InputOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getListInput(input: string, required?: boolean): string[] {
|
||||||
|
return core
|
||||||
|
.getInput(input, { required } as core.InputOptions)
|
||||||
|
.split("\n")
|
||||||
|
.filter(x => x !== "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public getBooleanInput(input: string, required?: boolean): boolean {
|
||||||
|
const inputValue = this.getInput(input, required);
|
||||||
|
return (inputValue || "false").toLowerCase() === "true";
|
||||||
|
}
|
||||||
|
|
||||||
|
public isValidInputFile(input: string, file: string): boolean {
|
||||||
|
return this.filePathSupplied(input) && this.fileExists(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public filePathSupplied(file: string): boolean {
|
||||||
|
const pathValue = path.resolve(this.getInput(file) || "");
|
||||||
|
const repoRoot = this.getSourceDir();
|
||||||
|
return pathValue !== repoRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public fileExists(file: string): boolean {
|
||||||
|
return this._exist(file) && this._stats(file).isFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public directoryExists(file: string): boolean {
|
||||||
|
return this._exist(file) && this._stats(file).isDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
private _exist(file: string): boolean {
|
||||||
|
let exist = false;
|
||||||
|
try {
|
||||||
|
exist = !!(file && fs.statSync(file) != null);
|
||||||
|
} catch (err) {
|
||||||
|
if (err && err.code === "ENOENT") {
|
||||||
|
exist = false;
|
||||||
|
} else {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return exist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _stats(file: string): fs.Stats {
|
||||||
|
return fs.statSync(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
BuildAgent,
|
||||||
|
};
|
||||||
109
src/agent/mock/build-agent.ts
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
import { injectable } from "inversify";
|
||||||
|
|
||||||
|
import { IBuildAgent, IExecResult } from "../../core/models";
|
||||||
|
|
||||||
|
@injectable()
|
||||||
|
class BuildAgent implements IBuildAgent {
|
||||||
|
|
||||||
|
public get agentName(): string {
|
||||||
|
console.log("getAgentName");
|
||||||
|
return "Mock";
|
||||||
|
}
|
||||||
|
|
||||||
|
public find(toolName: string, versionSpec: string, arch?: string): string {
|
||||||
|
console.log("find");
|
||||||
|
return "find";
|
||||||
|
}
|
||||||
|
|
||||||
|
public cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string> {
|
||||||
|
console.log("cacheDir");
|
||||||
|
return Promise.resolve("cacheDir");
|
||||||
|
}
|
||||||
|
|
||||||
|
public createTempDir(): Promise<string> {
|
||||||
|
console.log("createTempDir");
|
||||||
|
return Promise.resolve("createTempDir");
|
||||||
|
}
|
||||||
|
|
||||||
|
public debug(message: string): void {
|
||||||
|
console.log("debug");
|
||||||
|
}
|
||||||
|
|
||||||
|
public setFailed(message: string, done?: boolean): void {
|
||||||
|
console.log("setFailed");
|
||||||
|
}
|
||||||
|
|
||||||
|
public setSucceeded(message: string, done?: boolean): void {
|
||||||
|
console.log("setSucceeded");
|
||||||
|
}
|
||||||
|
|
||||||
|
public exportVariable(name: string, val: string): void {
|
||||||
|
console.log("exportVariable");
|
||||||
|
}
|
||||||
|
|
||||||
|
public getVariable(name: string): string {
|
||||||
|
console.log("getVariable");
|
||||||
|
return "getVariable";
|
||||||
|
}
|
||||||
|
|
||||||
|
public addPath(inputPath: string): void {
|
||||||
|
console.log("addPath");
|
||||||
|
}
|
||||||
|
|
||||||
|
public which(tool: string, check?: boolean): Promise<string> {
|
||||||
|
console.log("which");
|
||||||
|
return Promise.resolve("which");
|
||||||
|
}
|
||||||
|
|
||||||
|
public exec(exec: string, args: string[]): Promise<IExecResult> {
|
||||||
|
return Promise.resolve({
|
||||||
|
code: 0,
|
||||||
|
error: null,
|
||||||
|
stderr: "result.stderr",
|
||||||
|
stdout: "result.stdout",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public getSourceDir(): string {
|
||||||
|
console.log("getSourceDir");
|
||||||
|
return "getSourceDir";
|
||||||
|
}
|
||||||
|
|
||||||
|
public setOutput(name: string, value: string): void {
|
||||||
|
console.log("setOutput");
|
||||||
|
}
|
||||||
|
|
||||||
|
public getInput(input: string, required?: boolean): string {
|
||||||
|
console.log("getInput");
|
||||||
|
return "getInput";
|
||||||
|
}
|
||||||
|
|
||||||
|
public getListInput(input: string, required?: boolean): string[] {
|
||||||
|
console.log("getListInput");
|
||||||
|
return ["getInput"];
|
||||||
|
}
|
||||||
|
|
||||||
|
public getBooleanInput(input: string, required?: boolean): boolean {
|
||||||
|
console.log("getBooleanInput");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public isValidInputFile(input: string, file: string) {
|
||||||
|
console.log("isValidInputFile");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public fileExists(file: string) {
|
||||||
|
console.log("fileExists");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public directoryExists(file: string) {
|
||||||
|
console.log("directoryExists");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
BuildAgent,
|
||||||
|
};
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
import * as path from 'path';
|
|
||||||
|
|
||||||
import * as tl from 'azure-pipelines-task-lib/task';
|
|
||||||
import * as tr from 'azure-pipelines-task-lib/toolrunner';
|
|
||||||
|
|
||||||
import { ToolInstaller } from '../ToolInstaller';
|
|
||||||
import { Proxy as utils } from './Proxy';
|
|
||||||
|
|
||||||
export class GitVersionTask {
|
|
||||||
execOptions: tr.IExecOptions;
|
|
||||||
|
|
||||||
versionSpec: string;
|
|
||||||
includePrerelease: boolean;
|
|
||||||
targetPath: string;
|
|
||||||
|
|
||||||
useConfigFile: boolean;
|
|
||||||
configFilePath: string;
|
|
||||||
|
|
||||||
updateAssemblyInfo: boolean;
|
|
||||||
updateAssemblyInfoFilename: string;
|
|
||||||
|
|
||||||
additionalArguments: string;
|
|
||||||
|
|
||||||
sourcesDirectory: string;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
|
|
||||||
this.versionSpec = tl.getInput('versionSpec', true);
|
|
||||||
this.includePrerelease = tl.getBoolInput('includePrerelease');
|
|
||||||
this.targetPath = tl.getInput('targetPath');
|
|
||||||
|
|
||||||
this.useConfigFile = tl.getBoolInput('useConfigFile');
|
|
||||||
this.configFilePath = tl.getInput('configFilePath');
|
|
||||||
|
|
||||||
this.updateAssemblyInfo = tl.getBoolInput('updateAssemblyInfo');
|
|
||||||
this.updateAssemblyInfoFilename = tl.getInput('updateAssemblyInfoFilename');
|
|
||||||
|
|
||||||
this.additionalArguments = tl.getInput('additionalArguments');
|
|
||||||
|
|
||||||
this.sourcesDirectory = tl.getVariable('Build.SourcesDirectory').replace(/\\/g, '/');
|
|
||||||
|
|
||||||
this.execOptions = {
|
|
||||||
cwd: undefined,
|
|
||||||
env: undefined,
|
|
||||||
silent: undefined,
|
|
||||||
failOnStdErr: undefined,
|
|
||||||
ignoreReturnCode: undefined,
|
|
||||||
errStream: undefined,
|
|
||||||
outStream: undefined,
|
|
||||||
windowsVerbatimArguments: undefined
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public async execute() {
|
|
||||||
try {
|
|
||||||
let toolPath = await this.installTool(this.versionSpec, this.includePrerelease);
|
|
||||||
|
|
||||||
let workingDirectory = this.getWorkingDirectory(this.targetPath);
|
|
||||||
let exe = tl.tool('dotnet-gitversion');
|
|
||||||
exe.arg([
|
|
||||||
workingDirectory,
|
|
||||||
"/output",
|
|
||||||
"buildserver",
|
|
||||||
"/nofetch"]);
|
|
||||||
|
|
||||||
if (this.useConfigFile) {
|
|
||||||
if (tl.filePathSupplied('configFilePath') && tl.exist(this.configFilePath) && tl.stats(this.configFilePath).isFile()) {
|
|
||||||
exe.arg(["/config", this.configFilePath]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error('GitVersion configuration file not found at ' + this.configFilePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.updateAssemblyInfo) {
|
|
||||||
exe.arg("/updateassemblyinfo");
|
|
||||||
if (tl.filePathSupplied('updateAssemblyInfoFilename') && tl.exist(this.updateAssemblyInfoFilename) && tl.stats(this.updateAssemblyInfoFilename).isFile()) {
|
|
||||||
exe.arg(this.updateAssemblyInfoFilename);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error('AssemblyInfoFilename file not found at ' + this.updateAssemblyInfoFilename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.additionalArguments) {
|
|
||||||
exe.line(this.additionalArguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await exe.exec(this.execOptions);
|
|
||||||
if (result) {
|
|
||||||
tl.setResult(tl.TaskResult.Failed, "An error occured during GitVersion execution");
|
|
||||||
} else {
|
|
||||||
tl.setResult(tl.TaskResult.Succeeded, "GitVersion executed successfully");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
tl.debug(err.stack);
|
|
||||||
tl.setResult(tl.TaskResult.Failed, err, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async installTool(version: string, includePrerelease: boolean): Promise<string> {
|
|
||||||
let installTool = tl.getVariable("INSTALL_TOOL");
|
|
||||||
if (installTool === null || installTool === undefined || installTool.toUpperCase() == "TRUE") {
|
|
||||||
return await new ToolInstaller(utils).downloadAndInstall("GitVersion.Tool", version, false, includePrerelease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getWorkingDirectory(targetPath: string) {
|
|
||||||
let workDir;
|
|
||||||
|
|
||||||
if (!targetPath) {
|
|
||||||
workDir = this.sourcesDirectory;
|
|
||||||
} else {
|
|
||||||
if (tl.exist(targetPath) && tl.stats(targetPath).isDirectory()) {
|
|
||||||
workDir = path.join(this.sourcesDirectory, targetPath);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error('Directory not found at ' + targetPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return workDir.replace(/\\/g, '/');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var task = new GitVersionTask();
|
|
||||||
task.execute().catch((reason) => tl.setResult(tl.TaskResult.Failed, reason));
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "dd065e3b-6aef-46af-845c-520195836b35",
|
|
||||||
"name": "UseGitVersion",
|
|
||||||
"friendlyName": "GitVersion Task (Preview)",
|
|
||||||
"description": "Easy Semantic Versioning (http://semver.org) for projects using Git",
|
|
||||||
"author": "GitVersion Contributors",
|
|
||||||
"helpMarkDown": "See the [documentation](http://gitversion.readthedocs.org/en/latest/) for help",
|
|
||||||
"category": "Build",
|
|
||||||
"demands": [],
|
|
||||||
"version": {
|
|
||||||
"Major": "5",
|
|
||||||
"Minor": "1",
|
|
||||||
"Patch": "3"
|
|
||||||
},
|
|
||||||
"minimumAgentVersion": "2.115.0",
|
|
||||||
"groups": [
|
|
||||||
{
|
|
||||||
"name": "gitversionDetails",
|
|
||||||
"displayName": "GitVersion details",
|
|
||||||
"isExpanded": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "additional",
|
|
||||||
"displayName": "Additional Options",
|
|
||||||
"isExpanded": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"instanceNameFormat": "GitVersion",
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"name": "versionSpec",
|
|
||||||
"type": "string",
|
|
||||||
"label": "The version spec",
|
|
||||||
"defaultValue": "",
|
|
||||||
"required": true,
|
|
||||||
"helpMarkDown": "Required version in the form of 5.x or exact version like 5.0.0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "includePrerelease",
|
|
||||||
"type": "boolean",
|
|
||||||
"label": "Include pre-release versions",
|
|
||||||
"defaultValue": "false",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Include pre-release versions when matching a version"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "targetPath",
|
|
||||||
"type": "string",
|
|
||||||
"label": "Working directory path",
|
|
||||||
"defaultValue": "",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Optionally supply the path to the working directory",
|
|
||||||
"groupName": "gitversionDetails"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "useConfigFile",
|
|
||||||
"type": "boolean",
|
|
||||||
"label": "Specify Configuration file",
|
|
||||||
"defaultValue": "false",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Whether to use a custom configuration file"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "configFilePath",
|
|
||||||
"type": "filePath",
|
|
||||||
"label": "Configuration file",
|
|
||||||
"defaultValue": "",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Optional path to config file (defaults to GitVersion.yml)",
|
|
||||||
"visibleRule": "useConfigFile = true"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "updateAssemblyInfo",
|
|
||||||
"type": "boolean",
|
|
||||||
"label": "Update AssemblyInfo files",
|
|
||||||
"defaultValue": "false",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Whether to update versions in the AssemblyInfo files"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "updateAssemblyInfoFilename",
|
|
||||||
"type": "string",
|
|
||||||
"label": "Update Assembly File",
|
|
||||||
"defaultValue": "",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Update versions in specified file",
|
|
||||||
"visibleRule": "updateAssemblyInfo = true"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "additionalArguments",
|
|
||||||
"type": "string",
|
|
||||||
"label": "Additional GitVersion arguments",
|
|
||||||
"defaultValue": "",
|
|
||||||
"required": false,
|
|
||||||
"helpMarkDown": "Additional arguments to send to GitVersion",
|
|
||||||
"groupName": "additional"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"execution": {
|
|
||||||
"Node": {
|
|
||||||
"target": "GitVersion.js",
|
|
||||||
"argumentFormat": "",
|
|
||||||
"workingDirectory": "."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
|
|
||||||
import { createTempDir, executeDotNet } from './ToolLib';
|
|
||||||
import { findLocalTool, prependPath, cacheDir, isExplicitVersion, evaluateVersions, cleanVersion } from 'azure-pipelines-tool-lib/tool';
|
|
||||||
import { debug, setVariable, which } from 'azure-pipelines-task-lib/task';
|
|
||||||
|
|
||||||
function _which(tool: string, check?: boolean) : Promise<string> {
|
|
||||||
return Promise.resolve(which(tool, check));
|
|
||||||
}
|
|
||||||
import { IProxy } from '../Interfaces';
|
|
||||||
|
|
||||||
export const Proxy: IProxy = {
|
|
||||||
find: findLocalTool,
|
|
||||||
debug: debug,
|
|
||||||
exportVariable: setVariable,
|
|
||||||
addPath: prependPath,
|
|
||||||
which: _which,
|
|
||||||
cacheDir: cacheDir,
|
|
||||||
isExplicitVersion: isExplicitVersion,
|
|
||||||
evaluateVersions: evaluateVersions,
|
|
||||||
cleanVersion: cleanVersion,
|
|
||||||
createTempDir: createTempDir,
|
|
||||||
executeDotNet: executeDotNet
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import * as taskLib from 'azure-pipelines-task-lib/task';
|
|
||||||
|
|
||||||
export interface IExecSyncResult {
|
|
||||||
/** standard output */
|
|
||||||
stdout: string;
|
|
||||||
/** error output */
|
|
||||||
stderr: string;
|
|
||||||
/** return code */
|
|
||||||
code: number;
|
|
||||||
/** Error on failure */
|
|
||||||
error: Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function createTempDir(): Promise<string> {
|
|
||||||
let tempDir = taskLib.getVariable('Agent.TempDirectory');
|
|
||||||
return Promise.resolve(tempDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function executeDotNet(args: string[]): Promise<IExecSyncResult> {
|
|
||||||
let tr = taskLib.tool("dotnet");
|
|
||||||
tr.arg(args);
|
|
||||||
|
|
||||||
var result = tr.execSync();
|
|
||||||
return {
|
|
||||||
code: result.code,
|
|
||||||
stdout: result.stdout,
|
|
||||||
stderr: result.stderr,
|
|
||||||
error: result.error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
@@ -1,6 +0,0 @@
|
|||||||
Versioning when using Git, solved. GitVersion looks at your Git history and works out the [semantic version](http://semver.org) of the commit being built.
|
|
||||||
|
|
||||||
It works with most branching strategies but has been designed mainly around GitFlow and GitHubFlow (pull request workflow). The calculated version numbers can then be accessed through variables such as `$(GitVersion.NuGetVersion)` and `$(GitVersion.SemVer)`. It is also very configurable to allow it to work with most release workflows!
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
import * as path from 'path';
|
|
||||||
|
|
||||||
import * as ma from 'azure-pipelines-task-lib/mock-answer';
|
|
||||||
import * as tmrm from 'azure-pipelines-task-lib/mock-run';
|
|
||||||
import * as shared from './test-shared';
|
|
||||||
|
|
||||||
let taskDir = path.join(__dirname, '..');
|
|
||||||
let taskPath = path.join(taskDir, 'GitVersion.js');
|
|
||||||
let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);
|
|
||||||
|
|
||||||
process.env['BUILD_SOURCESDIRECTORY'] = shared.SharedValues.BUILD_SOURCESDIRECTORY;
|
|
||||||
process.env["INSTALL_TOOL"] = 'false';
|
|
||||||
|
|
||||||
tmr.setInput('versionSpec', process.env[shared.TestEnvVars.versionSpec] || '5.x');
|
|
||||||
tmr.setInput('includePrerelease', process.env[shared.TestEnvVars.includePrerelease] || 'false');
|
|
||||||
tmr.setInput('targetPath', process.env[shared.TestEnvVars.targetPath] || '');
|
|
||||||
|
|
||||||
tmr.setInput('useConfigFile', process.env[shared.TestEnvVars.useConfigFile] || 'false');
|
|
||||||
tmr.setInput('configFilePath', process.env[shared.TestEnvVars.configFilePath] || '');
|
|
||||||
|
|
||||||
tmr.setInput('updateAssemblyInfo', process.env[shared.TestEnvVars.updateAssemblyInfo] || 'false');
|
|
||||||
tmr.setInput('updateAssemblyInfoFilename', process.env[shared.TestEnvVars.updateAssemblyInfoFilename] || '');
|
|
||||||
|
|
||||||
tmr.setInput('additionalArguments', process.env[shared.TestEnvVars.additionalArguments] || '');
|
|
||||||
|
|
||||||
console.log("Inputs have been set");
|
|
||||||
|
|
||||||
let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
|
|
||||||
"which": { "dotnet-gitversion": "dotnet-gitversion" },
|
|
||||||
"checkPath": { "dotnet-gitversion": true },
|
|
||||||
"exec": {},
|
|
||||||
"exist": {
|
|
||||||
"src": true,
|
|
||||||
"customConfig.yml" : true,
|
|
||||||
"GlobalAssemblyInfo.cs" : true
|
|
||||||
},
|
|
||||||
"stats": {
|
|
||||||
"src" : {
|
|
||||||
"isDirectory" : true
|
|
||||||
},
|
|
||||||
"customConfig.yml" : {
|
|
||||||
"isFile": true
|
|
||||||
},
|
|
||||||
"GlobalAssemblyInfo.cs" : {
|
|
||||||
"isFile": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
a.exec["dotnet-gitversion " + shared.SharedValues.BUILD_SOURCESDIRECTORY + " /output buildserver /nofetch"] = {
|
|
||||||
"code": 0,
|
|
||||||
"stdout": "GitVersion run successfully with defaults",
|
|
||||||
"stderr": ""
|
|
||||||
};
|
|
||||||
|
|
||||||
a.exec["dotnet-gitversion " + shared.SharedValues.BUILD_SOURCESDIRECTORY + "/src /output buildserver /nofetch"] = {
|
|
||||||
"code": 0,
|
|
||||||
"stdout": "GitVersion run successfully with custom targetPath",
|
|
||||||
"stderr": ""
|
|
||||||
};
|
|
||||||
|
|
||||||
a.exec["dotnet-gitversion " + shared.SharedValues.BUILD_SOURCESDIRECTORY + " /output buildserver /nofetch /config customConfig.yml"] = {
|
|
||||||
"code": 0,
|
|
||||||
"stdout": "GitVersion run successfully with custom config",
|
|
||||||
"stderr": ""
|
|
||||||
};
|
|
||||||
|
|
||||||
a.exec["dotnet-gitversion " + shared.SharedValues.BUILD_SOURCESDIRECTORY + " /output buildserver /nofetch /updateassemblyinfo GlobalAssemblyInfo.cs"] = {
|
|
||||||
"code": 0,
|
|
||||||
"stdout": "GitVersion run successfully with custom assembly info",
|
|
||||||
"stderr": ""
|
|
||||||
};
|
|
||||||
|
|
||||||
var mt = require('azure-pipelines-task-lib/mock-task');
|
|
||||||
mt.assertAgent = (minimum: string) =>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
tmr.registerMockExport('mt', mt);
|
|
||||||
|
|
||||||
tmr.setAnswers(a);
|
|
||||||
|
|
||||||
tmr.run();
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
export let TestEnvVars = {
|
|
||||||
versionSpec: "__versionSpec__",
|
|
||||||
includePrerelease: "__includePrerelease__",
|
|
||||||
targetPath: "__targetPath__",
|
|
||||||
useConfigFile: "__useConfigFile__",
|
|
||||||
configFilePath: "__configFilePath__",
|
|
||||||
updateAssemblyInfo: "__updateAssemblyInfo__",
|
|
||||||
updateAssemblyInfoFilename: "__updateAssemblyInfoFilename__",
|
|
||||||
additionalArguments: "__additionalArguments__"
|
|
||||||
}
|
|
||||||
|
|
||||||
export let SharedValues = {
|
|
||||||
BUILD_SOURCESDIRECTORY: "/user/build"
|
|
||||||
}
|
|
||||||
@@ -1,246 +0,0 @@
|
|||||||
import * as path from 'path';
|
|
||||||
import * as assert from 'assert';
|
|
||||||
import * as ttm from 'azure-pipelines-task-lib/mock-test';
|
|
||||||
import * as shared from './test-shared';
|
|
||||||
|
|
||||||
function runValidations(validator: () => void, tr: ttm.MockTestRunner, done: MochaDone) {
|
|
||||||
try {
|
|
||||||
validator();
|
|
||||||
console.log(tr.succeeded);
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.log("STDERR", tr.stderr);
|
|
||||||
console.log("STDOUT", tr.stdout);
|
|
||||||
done(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('GitVersion Vsix Task tests', function () {
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
delete process.env[shared.TestEnvVars.useConfigFile];
|
|
||||||
delete process.env[shared.TestEnvVars.configFilePath];
|
|
||||||
delete process.env[shared.TestEnvVars.updateAssemblyInfo];
|
|
||||||
delete process.env[shared.TestEnvVars.updateAssemblyInfoFilename];
|
|
||||||
delete process.env[shared.TestEnvVars.additionalArguments];
|
|
||||||
delete process.env[shared.TestEnvVars.targetPath];
|
|
||||||
});
|
|
||||||
|
|
||||||
after(() => {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Succeeds: Runs GitVersion default configurations', function (done: MochaDone) {
|
|
||||||
this.timeout(1000);
|
|
||||||
|
|
||||||
let tp = path.join(__dirname, 'test-setup.js');
|
|
||||||
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
|
|
||||||
|
|
||||||
tr.run();
|
|
||||||
|
|
||||||
runValidations(() => {
|
|
||||||
|
|
||||||
assert(tr.succeeded, 'should have succeeded');
|
|
||||||
assert(tr.warningIssues.length == 0, "should have no warnings");
|
|
||||||
assert(tr.errorIssues.length == 0, "should have no errors");
|
|
||||||
assert(tr.stderr.length == 0, 'should not have written to stderr');
|
|
||||||
assert(tr.invokedToolCount == 1, 'should have invoked tool one time. actual: ' + tr.invokedToolCount);
|
|
||||||
assert(tr.ran("dotnet-gitversion /user/build /output buildserver /nofetch"));
|
|
||||||
|
|
||||||
assert(tr.stdOutContained('GitVersion run successfully with defaults'), "should display 'GitVersion run successfully with defaults'");
|
|
||||||
|
|
||||||
}, tr, done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Fails: Runs GitVersion with wrong targetPath', function (done: MochaDone) {
|
|
||||||
this.timeout(1000);
|
|
||||||
|
|
||||||
process.env[shared.TestEnvVars.targetPath] = 'wrongPath';
|
|
||||||
|
|
||||||
let tp = path.join(__dirname, 'test-setup.js');
|
|
||||||
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
|
|
||||||
|
|
||||||
tr.run();
|
|
||||||
|
|
||||||
runValidations(() => {
|
|
||||||
|
|
||||||
assert(tr.failed, 'should have failed');
|
|
||||||
assert(tr.warningIssues.length == 0, "should have no warnings");
|
|
||||||
assert(tr.errorIssues.length == 1, "should have thrown an error");
|
|
||||||
assert(tr.stderr.length == 0, 'should not have written to stderr');
|
|
||||||
assert(tr.invokedToolCount == 0, 'should not have invoked tool. actual: ' + tr.invokedToolCount);
|
|
||||||
|
|
||||||
assert(tr.stdOutContained('Directory not found'), "should display 'Directory not found'");
|
|
||||||
|
|
||||||
}, tr, done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Succeeds: Runs GitVersion with correct target', function (done: MochaDone) {
|
|
||||||
this.timeout(1000);
|
|
||||||
|
|
||||||
process.env[shared.TestEnvVars.targetPath] = 'src';
|
|
||||||
|
|
||||||
let tp = path.join(__dirname, 'test-setup.js');
|
|
||||||
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
|
|
||||||
|
|
||||||
tr.run();
|
|
||||||
|
|
||||||
runValidations(() => {
|
|
||||||
|
|
||||||
assert(tr.succeeded, 'should have succeeded');
|
|
||||||
assert(tr.warningIssues.length == 0, "should have no warnings");
|
|
||||||
assert(tr.errorIssues.length == 0, "should have no errors");
|
|
||||||
assert(tr.stderr.length == 0, 'should not have written to stderr');
|
|
||||||
assert(tr.invokedToolCount == 1, 'should have invoked tool one time. actual: ' + tr.invokedToolCount);
|
|
||||||
assert(tr.ran("dotnet-gitversion /user/build/src /output buildserver /nofetch"));
|
|
||||||
|
|
||||||
assert(tr.stdOutContained('GitVersion run successfully with custom targetPath'), "should display 'GitVersion run successfully with custom targetPath'");
|
|
||||||
|
|
||||||
}, tr, done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Fails: Runs GitVersion with no configuration file specified', function (done: MochaDone) {
|
|
||||||
this.timeout(1000);
|
|
||||||
|
|
||||||
process.env[shared.TestEnvVars.useConfigFile] = 'true';
|
|
||||||
|
|
||||||
let tp = path.join(__dirname, 'test-setup.js');
|
|
||||||
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
|
|
||||||
|
|
||||||
tr.run();
|
|
||||||
|
|
||||||
runValidations(() => {
|
|
||||||
|
|
||||||
assert.equal(tr.succeeded, false, 'should have failed');
|
|
||||||
assert(tr.warningIssues.length == 0, "should have no warnings");
|
|
||||||
assert(tr.errorIssues.length == 1, "should have thrown an error");
|
|
||||||
assert(tr.stderr.length == 0, 'should not have written to stderr');
|
|
||||||
assert(tr.invokedToolCount == 0, 'should not have invoked tool. actual: ' + tr.invokedToolCount);
|
|
||||||
|
|
||||||
assert(tr.stdOutContained('GitVersion configuration file not found'), "should display 'GitVersion configuration file not found'");
|
|
||||||
|
|
||||||
}, tr, done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Fails: Runs GitVersion with wrong configuration file specified', function (done: MochaDone) {
|
|
||||||
this.timeout(1000);
|
|
||||||
|
|
||||||
process.env[shared.TestEnvVars.useConfigFile] = 'true';
|
|
||||||
process.env[shared.TestEnvVars.configFilePath] = 'wronfConfig.yml';
|
|
||||||
|
|
||||||
let tp = path.join(__dirname, 'test-setup.js');
|
|
||||||
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
|
|
||||||
|
|
||||||
tr.run();
|
|
||||||
|
|
||||||
runValidations(() => {
|
|
||||||
|
|
||||||
assert(tr.failed, 'should have failed');
|
|
||||||
assert(tr.warningIssues.length == 0, "should have no warnings");
|
|
||||||
assert(tr.errorIssues.length == 1, "should have thrown an error");
|
|
||||||
assert(tr.stderr.length == 0, 'should not have written to stderr');
|
|
||||||
assert(tr.invokedToolCount == 0, 'should not have invoked tool. actual: ' + tr.invokedToolCount);
|
|
||||||
|
|
||||||
assert(tr.stdOutContained('GitVersion configuration file not found'), "should display 'GitVersion configuration file not found'");
|
|
||||||
|
|
||||||
}, tr, done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Succeeds: Runs GitVersion with correct custom configuration file specified', function (done: MochaDone) {
|
|
||||||
this.timeout(1000);
|
|
||||||
|
|
||||||
process.env[shared.TestEnvVars.useConfigFile] = 'true';
|
|
||||||
process.env[shared.TestEnvVars.configFilePath] = 'customConfig.yml';
|
|
||||||
|
|
||||||
let tp = path.join(__dirname, 'test-setup.js');
|
|
||||||
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
|
|
||||||
|
|
||||||
tr.run();
|
|
||||||
|
|
||||||
runValidations(() => {
|
|
||||||
|
|
||||||
assert(tr.succeeded, 'should have succeeded');
|
|
||||||
assert(tr.warningIssues.length == 0, "should have no warnings");
|
|
||||||
assert(tr.errorIssues.length == 0, "should have no error");
|
|
||||||
assert(tr.stderr.length == 0, 'should not have written to stderr');
|
|
||||||
assert(tr.invokedToolCount == 1, 'should have invoked tool one time. actual: ' + tr.invokedToolCount);
|
|
||||||
assert(tr.ran("dotnet-gitversion /user/build /output buildserver /nofetch /config customConfig.yml"));
|
|
||||||
|
|
||||||
assert(tr.stdOutContained('GitVersion run successfully with custom config'), "should display 'GitVersion run successfully with custom config'");
|
|
||||||
|
|
||||||
}, tr, done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Fails: Runs GitVersion with no assembly info file specified', function (done: MochaDone) {
|
|
||||||
this.timeout(1000);
|
|
||||||
|
|
||||||
process.env[shared.TestEnvVars.updateAssemblyInfo] = 'true';
|
|
||||||
|
|
||||||
let tp = path.join(__dirname, 'test-setup.js');
|
|
||||||
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
|
|
||||||
|
|
||||||
tr.run();
|
|
||||||
|
|
||||||
runValidations(() => {
|
|
||||||
|
|
||||||
assert(tr.failed, 'should have failed');
|
|
||||||
assert(tr.warningIssues.length == 0, "should have no warnings");
|
|
||||||
assert(tr.errorIssues.length == 1, "should have thrown an error");
|
|
||||||
assert(tr.stderr.length == 0, 'should not have written to stderr');
|
|
||||||
assert(tr.invokedToolCount == 0, 'should not have invoked tool. actual: ' + tr.invokedToolCount);
|
|
||||||
|
|
||||||
assert(tr.stdOutContained('AssemblyInfoFilename file not found'), "should display 'AssemblyInfoFilename file not found'");
|
|
||||||
|
|
||||||
}, tr, done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Fails: Runs GitVersion with wrong assembly info file specified', function (done: MochaDone) {
|
|
||||||
this.timeout(1000);
|
|
||||||
|
|
||||||
process.env[shared.TestEnvVars.updateAssemblyInfo] = 'true';
|
|
||||||
process.env[shared.TestEnvVars.updateAssemblyInfoFilename] = 'wrongAssemblyInfo.cs';
|
|
||||||
|
|
||||||
let tp = path.join(__dirname, 'test-setup.js');
|
|
||||||
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
|
|
||||||
|
|
||||||
tr.run();
|
|
||||||
|
|
||||||
runValidations(() => {
|
|
||||||
|
|
||||||
assert(tr.failed, 'should have failed');
|
|
||||||
assert(tr.warningIssues.length == 0, "should have no warnings");
|
|
||||||
assert(tr.errorIssues.length == 1, "should have thrown an error");
|
|
||||||
assert(tr.stderr.length == 0, 'should not have written to stderr');
|
|
||||||
assert(tr.invokedToolCount == 0, 'should not have invoked tool. actual: ' + tr.invokedToolCount);
|
|
||||||
|
|
||||||
assert(tr.stdOutContained('AssemblyInfoFilename file not found'), "should display 'AssemblyInfoFilename file not found'");
|
|
||||||
|
|
||||||
}, tr, done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Succeeds: Runs GitVersion with correct custom assembly info file specified', function (done: MochaDone) {
|
|
||||||
this.timeout(1000);
|
|
||||||
|
|
||||||
process.env[shared.TestEnvVars.updateAssemblyInfo] = 'true';
|
|
||||||
process.env[shared.TestEnvVars.updateAssemblyInfoFilename] = 'GlobalAssemblyInfo.cs';
|
|
||||||
|
|
||||||
let tp = path.join(__dirname, 'test-setup.js');
|
|
||||||
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
|
|
||||||
|
|
||||||
tr.run();
|
|
||||||
|
|
||||||
runValidations(() => {
|
|
||||||
|
|
||||||
assert(tr.succeeded, 'should have succeeded');
|
|
||||||
assert(tr.warningIssues.length == 0, "should have no warnings");
|
|
||||||
assert(tr.errorIssues.length == 0, "should have no errors");
|
|
||||||
assert(tr.stderr.length == 0, 'should not have written to stderr');
|
|
||||||
assert(tr.invokedToolCount == 1, 'should have invoked tool one time. actual: ' + tr.invokedToolCount);
|
|
||||||
assert(tr.ran("dotnet-gitversion /user/build /output buildserver /nofetch /updateassemblyinfo GlobalAssemblyInfo.cs"));
|
|
||||||
|
|
||||||
assert(tr.stdOutContained('GitVersion run successfully with custom assembly info'), "should display 'GitVersion run successfully with custom assembly info'");
|
|
||||||
|
|
||||||
}, tr, done);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "commonjs",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"noImplicitAny": true,
|
|
||||||
"removeComments": true,
|
|
||||||
"preserveConstEnums": true,
|
|
||||||
"target": "es6",
|
|
||||||
"sourceMap": false,
|
|
||||||
"inlineSourceMap": true,
|
|
||||||
"declaration": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "commonjs",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"noImplicitAny": true,
|
|
||||||
"removeComments": true,
|
|
||||||
"preserveConstEnums": true,
|
|
||||||
"target": "es6",
|
|
||||||
"sourceMap": false,
|
|
||||||
"inlineSourceMap": true
|
|
||||||
},
|
|
||||||
"exclude": ["tests"]
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
{
|
|
||||||
"manifestVersion": 1,
|
|
||||||
"id": "usegitversion-preview",
|
|
||||||
"name": "UseGitVersion (Preview)",
|
|
||||||
"publisher": "gittools",
|
|
||||||
"public": true,
|
|
||||||
"author": "GitVersion Contributors",
|
|
||||||
"version": "5.1.3.1911100642",
|
|
||||||
"description": "Build task for easy semantic versioning for projects using Git.",
|
|
||||||
"targets": [{
|
|
||||||
"id": "Microsoft.VisualStudio.Services"
|
|
||||||
}],
|
|
||||||
"files": [
|
|
||||||
{ "path": "GitVersionTask" }
|
|
||||||
],
|
|
||||||
"categories": [
|
|
||||||
"Azure Pipelines"
|
|
||||||
],
|
|
||||||
"galleryFlags": [
|
|
||||||
"Preview"
|
|
||||||
],
|
|
||||||
"icons": {
|
|
||||||
"default": "images/extension-icon.png"
|
|
||||||
},
|
|
||||||
"tags": [
|
|
||||||
"semver",
|
|
||||||
"git",
|
|
||||||
"versioning",
|
|
||||||
"gitflow",
|
|
||||||
"githubflow"
|
|
||||||
],
|
|
||||||
"links": {
|
|
||||||
"learn": {
|
|
||||||
"uri": "http://gitversion.readthedocs.org/en/stable"
|
|
||||||
},
|
|
||||||
"getstarted": {
|
|
||||||
"uri": "http://gitversion.readthedocs.org/en/stable/build-server-support/build-server/tfs-build-vnext/#running-inside-tfs"
|
|
||||||
},
|
|
||||||
"license": {
|
|
||||||
"uri": "https://github.com/GitTools/GitVersion/blob/master/LICENSE"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"uri": "https://github.com/GitTools/GitVersion"
|
|
||||||
},
|
|
||||||
"support": {
|
|
||||||
"uri": "https://github.com/GitTools/GitVersion/issues"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"screenshots": [{
|
|
||||||
"path": "images/builds.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "images/build-task.png"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"content": {
|
|
||||||
"details": {
|
|
||||||
"path": "overview.md"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"contributions": [{
|
|
||||||
"id": "gitversion-task",
|
|
||||||
"type": "ms.vss-distributed-task.task",
|
|
||||||
"targets": [
|
|
||||||
"ms.vss-distributed-task.tasks"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"name": "GitVersionTask"
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
151
src/core/dotnet-tool.ts
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
import * as fs from "fs";
|
||||||
|
import * as os from "os";
|
||||||
|
import * as path from "path";
|
||||||
|
import * as http from "typed-rest-client/HttpClient";
|
||||||
|
|
||||||
|
import { inject, injectable } from "inversify";
|
||||||
|
import { TYPES, IExecResult, IBuildAgent } from "./models";
|
||||||
|
import { IVersionManager } from "./versionManager";
|
||||||
|
|
||||||
|
export interface IDotnetTool {
|
||||||
|
disableTelemetry(): void;
|
||||||
|
toolInstall(toolName: string, versionSpec: string, checkLatest: boolean, includePre: boolean): Promise<string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
@injectable()
|
||||||
|
export class DotnetTool implements IDotnetTool {
|
||||||
|
|
||||||
|
protected buildAgent: IBuildAgent;
|
||||||
|
protected versionManager: IVersionManager;
|
||||||
|
private httpClient: http.HttpClient;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent,
|
||||||
|
@inject(TYPES.IVersionManager) versionManager: IVersionManager,
|
||||||
|
) {
|
||||||
|
this.buildAgent = buildAgent;
|
||||||
|
this.versionManager = versionManager;
|
||||||
|
this.httpClient = new http.HttpClient("dotnet");
|
||||||
|
}
|
||||||
|
|
||||||
|
public disableTelemetry(): void {
|
||||||
|
this.buildAgent.exportVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1");
|
||||||
|
}
|
||||||
|
|
||||||
|
public execute(cmd: string, args: string[]): Promise<IExecResult> {
|
||||||
|
console.log(`Command: ${cmd} ${args.join(' ')}`);
|
||||||
|
return this.buildAgent.exec(cmd, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async toolInstall(toolName: string, versionSpec: string, checkLatest: boolean, includePre: boolean)
|
||||||
|
: Promise<string> {
|
||||||
|
console.log("");
|
||||||
|
console.log("--------------------------");
|
||||||
|
console.log(`Installing ${toolName} version ` + versionSpec);
|
||||||
|
console.log("--------------------------");
|
||||||
|
|
||||||
|
if (this.versionManager.isExplicitVersion(versionSpec)) {
|
||||||
|
checkLatest = false; // check latest doesn't make sense when explicit version
|
||||||
|
}
|
||||||
|
|
||||||
|
let toolPath: string;
|
||||||
|
if (!checkLatest) {
|
||||||
|
//
|
||||||
|
// Let's try and resolve the version spec locally first
|
||||||
|
//
|
||||||
|
toolPath = this.buildAgent.find(toolName, versionSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!toolPath) {
|
||||||
|
let version: string;
|
||||||
|
if (this.versionManager.isExplicitVersion(versionSpec)) {
|
||||||
|
//
|
||||||
|
// Explicit version was specified. No need to query for list of versions.
|
||||||
|
//
|
||||||
|
version = versionSpec;
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Let's query and resolve the latest version for the versionSpec.
|
||||||
|
// If the version is an explicit version (1.1.1 or v1.1.1) then no need to query.
|
||||||
|
// If your tool doesn't offer a mechanism to query,
|
||||||
|
// then it can only support exact version inputs.
|
||||||
|
//
|
||||||
|
version = await this.queryLatestMatch(toolName, versionSpec, includePre);
|
||||||
|
if (!version) {
|
||||||
|
throw new Error(`Unable to find ${toolName} version '${versionSpec}'.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check the cache for the resolved version.
|
||||||
|
//
|
||||||
|
toolPath = this.buildAgent.find(toolName, version);
|
||||||
|
}
|
||||||
|
if (!toolPath) {
|
||||||
|
//
|
||||||
|
// Download, extract, cache
|
||||||
|
//
|
||||||
|
toolPath = await this.acquireTool(toolName, version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepend the tools path. This prepends the PATH for the current process and
|
||||||
|
// instructs the agent to prepend for each task that follows.
|
||||||
|
//
|
||||||
|
this.buildAgent.debug(`toolPath: ${toolPath}`);
|
||||||
|
|
||||||
|
if (os.platform() !== "win32") {
|
||||||
|
const dotnetRoot = path.dirname(fs.readlinkSync(await this.buildAgent.which("dotnet")));
|
||||||
|
this.buildAgent.exportVariable("DOTNET_ROOT", dotnetRoot);
|
||||||
|
}
|
||||||
|
this.buildAgent.addPath(toolPath);
|
||||||
|
|
||||||
|
return toolPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async queryLatestMatch(toolName: string, versionSpec: string, includePrerelease: boolean): Promise<string> {
|
||||||
|
this.buildAgent.debug(`querying tool versions for ${toolName}${versionSpec ? `@${versionSpec}` : ""} ${includePrerelease ? "including pre-releases" : ""}`);
|
||||||
|
|
||||||
|
const downloadPath = `https://api-v2v3search-0.nuget.org/query?q=${encodeURIComponent(toolName.toLowerCase())}&prerelease=${includePrerelease ? "true" : "false"}&semVerLevel=2.0.0`;
|
||||||
|
const res = await this.httpClient.get(downloadPath);
|
||||||
|
|
||||||
|
if (!res || res.message.statusCode !== 200) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const body: string = await res.readBody();
|
||||||
|
const data = JSON.parse(body).data;
|
||||||
|
|
||||||
|
const versions = (data[0].versions as { version: string }[]).map((x) => x.version);
|
||||||
|
if (!versions || !versions.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.buildAgent.debug(`got versions: ${versions.join(", ")}`);
|
||||||
|
|
||||||
|
return this.versionManager.evaluateVersions(versions, versionSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async acquireTool(toolName: string, version: string): Promise<string> {
|
||||||
|
|
||||||
|
const tempDirectory = await this.buildAgent.createTempDir();
|
||||||
|
let args = ["tool", "install", toolName, "--tool-path", tempDirectory];
|
||||||
|
|
||||||
|
if (version) {
|
||||||
|
version = this.versionManager.cleanVersion(version);
|
||||||
|
args = args.concat(["--version", version]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await this.execute("dotnet", args);
|
||||||
|
const status = result.code === 0 ? "success" : "failure";
|
||||||
|
const message = result.code === 0 ? result.stdout : result.stderr;
|
||||||
|
|
||||||
|
this.buildAgent.debug(`tool install result: ${status} ${message}`);
|
||||||
|
|
||||||
|
if (result.code) {
|
||||||
|
throw new Error("Error installing tool");
|
||||||
|
}
|
||||||
|
|
||||||
|
return await this.buildAgent.cacheDir(tempDirectory, toolName, version);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/core/ioc.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { Container } from "inversify";
|
||||||
|
import { IVersionManager, VersionManager } from "./versionManager";
|
||||||
|
import { TYPES, IBuildAgent } from "./models";
|
||||||
|
import { BuildAgent } from "../agent/mock/build-agent";
|
||||||
|
|
||||||
|
const container = new Container();
|
||||||
|
|
||||||
|
container.bind<IVersionManager>(TYPES.IVersionManager).to(VersionManager);
|
||||||
|
container.bind<IBuildAgent>(TYPES.IBuildAgent).to(BuildAgent);
|
||||||
|
|
||||||
|
export default container;
|
||||||
49
src/core/models.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
export const TYPES = {
|
||||||
|
IBuildAgent: Symbol.for("BuildAgent"),
|
||||||
|
IDotnetTool: Symbol.for("DotnetTool"),
|
||||||
|
IGitVersionTool: Symbol.for("GitVersionTool"),
|
||||||
|
IGitReleaseManagerTool: Symbol.for("GitReleaseManagerTool"),
|
||||||
|
IVersionManager: Symbol.for("VersionManager"),
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum SetupFields {
|
||||||
|
includePrerelease = "includePrerelease",
|
||||||
|
versionSpec = "versionSpec",
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface ISetupSettings {
|
||||||
|
[SetupFields.versionSpec]: string;
|
||||||
|
[SetupFields.includePrerelease]: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IExecResult {
|
||||||
|
stdout: string;
|
||||||
|
stderr: string;
|
||||||
|
code: number;
|
||||||
|
error: Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IBuildAgent {
|
||||||
|
agentName: string;
|
||||||
|
find(toolName: string, versionSpec: string, arch?: string): string;
|
||||||
|
cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string>;
|
||||||
|
createTempDir(): Promise<string>;
|
||||||
|
debug(message: string): void;
|
||||||
|
setFailed(message: string, done?: boolean): void;
|
||||||
|
setSucceeded(message: string, done?: boolean): void;
|
||||||
|
exportVariable(name: string, val: string): void;
|
||||||
|
getVariable(name: string): string;
|
||||||
|
addPath(inputPath: string): void;
|
||||||
|
which(tool: string, check?: boolean): Promise<string>;
|
||||||
|
exec(exec: string, args: string[]): Promise<IExecResult>;
|
||||||
|
|
||||||
|
getSourceDir(): string;
|
||||||
|
isValidInputFile(input: string, file: string): boolean;
|
||||||
|
fileExists(file: string): boolean;
|
||||||
|
directoryExists(file: string): boolean;
|
||||||
|
|
||||||
|
setOutput(name: string, value: string): void;
|
||||||
|
getInput(input: string, required?: boolean): string;
|
||||||
|
getListInput(input: string, required?: boolean): string[];
|
||||||
|
getBooleanInput(input: string, required?: boolean): boolean;
|
||||||
|
}
|
||||||
14
src/core/settings.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { IBuildAgent, SetupFields, ISetupSettings } from "./models";
|
||||||
|
|
||||||
|
export class Settings {
|
||||||
|
|
||||||
|
public static getSetupSettings(buildAgent: IBuildAgent): ISetupSettings {
|
||||||
|
const versionSpec = buildAgent.getInput(SetupFields.versionSpec);
|
||||||
|
const includePrerelease = buildAgent.getBooleanInput(SetupFields.includePrerelease);
|
||||||
|
|
||||||
|
return {
|
||||||
|
versionSpec,
|
||||||
|
includePrerelease
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
59
src/core/versionManager.ts
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import cmp from "semver-compare";
|
||||||
|
import * as semver from "semver";
|
||||||
|
import { injectable, inject } from "inversify";
|
||||||
|
|
||||||
|
import { IBuildAgent, TYPES } from "./models";
|
||||||
|
|
||||||
|
export interface IVersionManager {
|
||||||
|
isExplicitVersion(versionSpec: string): boolean;
|
||||||
|
evaluateVersions(versions: string[], versionSpec: string): string;
|
||||||
|
cleanVersion(version: string): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
@injectable()
|
||||||
|
export class VersionManager implements IVersionManager {
|
||||||
|
|
||||||
|
private buildAgent: IBuildAgent;
|
||||||
|
constructor(
|
||||||
|
@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent,
|
||||||
|
) {
|
||||||
|
this.buildAgent = buildAgent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public isExplicitVersion(versionSpec: string): boolean {
|
||||||
|
const c = semver.clean(versionSpec);
|
||||||
|
this.buildAgent.debug("isExplicit: " + c);
|
||||||
|
|
||||||
|
const valid = semver.valid(c) != null;
|
||||||
|
this.buildAgent.debug("explicit? " + valid);
|
||||||
|
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public evaluateVersions(versions: string[], versionSpec: string): string {
|
||||||
|
let version: string;
|
||||||
|
this.buildAgent.debug("evaluating " + versions.length + " versions");
|
||||||
|
versions = versions.sort(cmp);
|
||||||
|
for (let i = versions.length - 1; i >= 0; i--) {
|
||||||
|
const potential: string = versions[i];
|
||||||
|
const satisfied: boolean = semver.satisfies(potential, versionSpec);
|
||||||
|
if (satisfied) {
|
||||||
|
version = potential;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version) {
|
||||||
|
this.buildAgent.debug("matched: " + version);
|
||||||
|
} else {
|
||||||
|
this.buildAgent.debug("match not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public cleanVersion(version: string): string {
|
||||||
|
this.buildAgent.debug("cleaning: " + version);
|
||||||
|
return semver.clean(version);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import * as core from '@actions/core';
|
|
||||||
import { ToolInstaller } from '../ToolInstaller';
|
|
||||||
import { Proxy as utils } from './Proxy';
|
|
||||||
try {
|
|
||||||
let toolInstaller = new ToolInstaller(utils);
|
|
||||||
toolInstaller.downloadAndInstall('GitVersion.Tool', '5.1.2', false, false);
|
|
||||||
// `who-to-greet` input defined in action metadata file
|
|
||||||
const nameToGreet = core.getInput('who-to-greet');
|
|
||||||
console.log(`Hello ${nameToGreet}!`);
|
|
||||||
const time = (new Date()).toTimeString();
|
|
||||||
core.setOutput("time", time);
|
|
||||||
// Get the JSON webhook payload for the event that triggered the workflow
|
|
||||||
} catch (error) {
|
|
||||||
core.setFailed(error.message);
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import { find, cacheDir } from '@actions/tool-cache';
|
|
||||||
import { debug, exportVariable, addPath } from '@actions/core';
|
|
||||||
import { which } from '@actions/io';
|
|
||||||
|
|
||||||
import { isExplicitVersion, evaluateVersions, createTempDir, cleanVersion, executeDotNet } from './ToolLib';
|
|
||||||
import { IProxy } from '../Interfaces';
|
|
||||||
|
|
||||||
export const Proxy: IProxy = {
|
|
||||||
find : find,
|
|
||||||
debug: debug,
|
|
||||||
exportVariable: exportVariable,
|
|
||||||
addPath: addPath,
|
|
||||||
which: which,
|
|
||||||
cacheDir: cacheDir,
|
|
||||||
isExplicitVersion: isExplicitVersion,
|
|
||||||
evaluateVersions: evaluateVersions,
|
|
||||||
cleanVersion: cleanVersion,
|
|
||||||
createTempDir: createTempDir,
|
|
||||||
executeDotNet: executeDotNet
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
import * as path from 'path';
|
|
||||||
import * as semver from 'semver';
|
|
||||||
import * as uuidV4 from "uuid/v4";
|
|
||||||
|
|
||||||
import * as io from '@actions/io';
|
|
||||||
import * as core from '@actions/core';
|
|
||||||
import * as exec from '@actions/exec';
|
|
||||||
import { IExecSyncResult } from '../Interfaces';
|
|
||||||
|
|
||||||
const cmp = require('semver-compare');
|
|
||||||
|
|
||||||
export async function createTempDir(): Promise<string> {
|
|
||||||
const IS_WINDOWS = process.platform === "win32";
|
|
||||||
|
|
||||||
let tempDirectory: string = process.env["RUNNER_TEMP"] || "";
|
|
||||||
|
|
||||||
if (!tempDirectory) {
|
|
||||||
let baseLocation: string;
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
// On Windows use the USERPROFILE env variable
|
|
||||||
baseLocation = process.env["USERPROFILE"] || "C:\\";
|
|
||||||
} else {
|
|
||||||
if (process.platform === "darwin") {
|
|
||||||
baseLocation = "/Users";
|
|
||||||
} else {
|
|
||||||
baseLocation = "/home";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tempDirectory = path.join(baseLocation, "actions", "temp");
|
|
||||||
}
|
|
||||||
const dest = path.join(tempDirectory, uuidV4());
|
|
||||||
await io.mkdirP(dest);
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a version spec is an explicit version (e.g. 1.0.1 or v1.0.1)
|
|
||||||
* As opposed to a version spec like 1.x
|
|
||||||
*
|
|
||||||
* @param versionSpec
|
|
||||||
*/
|
|
||||||
export function isExplicitVersion(versionSpec: string): boolean {
|
|
||||||
let c = semver.clean(versionSpec);
|
|
||||||
core.debug('isExplicit: ' + c);
|
|
||||||
|
|
||||||
let valid = semver.valid(c) != null;
|
|
||||||
core.debug('explicit? ' + valid);
|
|
||||||
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix)
|
|
||||||
* and parsed version, or null if version is invalid.
|
|
||||||
*/
|
|
||||||
export function cleanVersion(version: string): string {
|
|
||||||
core.debug('cleaning: ' + version);
|
|
||||||
return semver.clean(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* evaluates a list of versions and returns the latest version matching the version spec
|
|
||||||
*
|
|
||||||
* @param versions an array of versions to evaluate
|
|
||||||
* @param versionSpec a version spec (e.g. 1.x)
|
|
||||||
*/
|
|
||||||
export function evaluateVersions(versions: string[], versionSpec: string): string {
|
|
||||||
let version: string;
|
|
||||||
core.debug('evaluating ' + versions.length + ' versions');
|
|
||||||
versions = versions.sort(cmp);
|
|
||||||
for (let i = versions.length - 1; i >= 0; i--) {
|
|
||||||
let potential: string = versions[i];
|
|
||||||
let satisfied: boolean = semver.satisfies(potential, versionSpec);
|
|
||||||
if (satisfied) {
|
|
||||||
version = potential;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version) {
|
|
||||||
core.debug('matched: ' + version);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.debug('match not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function executeDotNet(args: string[]) : Promise<IExecSyncResult> {
|
|
||||||
let dotnetPath = await io.which("dotnet", true);
|
|
||||||
let resultCode = 0;
|
|
||||||
let stdout = '';
|
|
||||||
let stderr = '';
|
|
||||||
resultCode = await exec.exec(
|
|
||||||
`"${dotnetPath}"`,
|
|
||||||
args,
|
|
||||||
{
|
|
||||||
listeners: {
|
|
||||||
stdout: (data: Buffer) => {
|
|
||||||
stdout += data.toString();
|
|
||||||
},
|
|
||||||
stderr: (data: Buffer) => {
|
|
||||||
stderr += data.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
code: resultCode,
|
|
||||||
stdout: stdout,
|
|
||||||
stderr: stderr,
|
|
||||||
error: null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "commonjs",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"noImplicitAny": true,
|
|
||||||
"removeComments": true,
|
|
||||||
"preserveConstEnums": true,
|
|
||||||
"target": "es6",
|
|
||||||
"sourceMap": false,
|
|
||||||
"inlineSourceMap": true,
|
|
||||||
"declaration": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
4
src/tasks/gitreleasemanager/create.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import "reflect-metadata";
|
||||||
|
import { create } from "./main";
|
||||||
|
|
||||||
|
create();
|
||||||
4
src/tasks/gitreleasemanager/discard.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import "reflect-metadata";
|
||||||
|
import { discard } from "./main";
|
||||||
|
|
||||||
|
discard();
|
||||||
56
src/tasks/gitreleasemanager/main.ts
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import { IBuildAgent, TYPES, SetupFields } from "../../core/models";
|
||||||
|
import { IGitReleaseManagerTool, GitReleaseManagerTool } from "../../tools/gitreleasemanager/tool";
|
||||||
|
import { Settings as CommonSettings } from "../../core/settings";
|
||||||
|
import { Settings } from "../../tools/gitreleasemanager/settings";
|
||||||
|
|
||||||
|
import container from "../../core/ioc";
|
||||||
|
|
||||||
|
container.bind<IGitReleaseManagerTool>(TYPES.IGitReleaseManagerTool).to(GitReleaseManagerTool);
|
||||||
|
|
||||||
|
const gitReleaseManagerTool = container.get<IGitReleaseManagerTool>(TYPES.IGitReleaseManagerTool);
|
||||||
|
const buildAgent = container.get<IBuildAgent>(TYPES.IBuildAgent);
|
||||||
|
|
||||||
|
export async function setup() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
gitReleaseManagerTool.disableTelemetry();
|
||||||
|
|
||||||
|
const settings = CommonSettings.getSetupSettings(buildAgent);
|
||||||
|
|
||||||
|
await gitReleaseManagerTool.install(settings.versionSpec, settings.includePrerelease);
|
||||||
|
|
||||||
|
buildAgent.setSucceeded("GitVersionManager installed successfully", true);
|
||||||
|
} catch (error) {
|
||||||
|
buildAgent.setFailed(error.message, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function create() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
gitReleaseManagerTool.disableTelemetry();
|
||||||
|
|
||||||
|
const settings = Settings.getCreateSettings(buildAgent);
|
||||||
|
|
||||||
|
await gitReleaseManagerTool.create(settings);
|
||||||
|
|
||||||
|
buildAgent.setSucceeded("GitVersionManager created release successfully", true);
|
||||||
|
} catch (error) {
|
||||||
|
buildAgent.setFailed(error.message, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function discard() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
gitReleaseManagerTool.disableTelemetry();
|
||||||
|
|
||||||
|
const settings = Settings.getDiscardSettings(buildAgent);
|
||||||
|
|
||||||
|
await gitReleaseManagerTool.discard(settings);
|
||||||
|
|
||||||
|
buildAgent.setSucceeded("GitVersionManager discarded release successfully", true);
|
||||||
|
} catch (error) {
|
||||||
|
buildAgent.setFailed(error.message, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
4
src/tasks/gitreleasemanager/setup.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import "reflect-metadata";
|
||||||
|
import { setup } from "./main";
|
||||||
|
|
||||||
|
setup();
|
||||||
4
src/tasks/gitversion/execute.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import "reflect-metadata";
|
||||||
|
import { run } from "./main";
|
||||||
|
|
||||||
|
run();
|
||||||
50
src/tasks/gitversion/main.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import { IBuildAgent, TYPES, SetupFields } from "../../core/models";
|
||||||
|
import { Settings as CommonSettings } from "../../core/settings";
|
||||||
|
import { Settings } from "../../tools/gitversion/settings";
|
||||||
|
import { IGitVersionTool, GitVersionTool } from "../../tools/gitversion/tool";
|
||||||
|
import { GitVersionSettings, GitVersionOutput } from "../../tools/gitversion/models";
|
||||||
|
|
||||||
|
import container from "../../core/ioc";
|
||||||
|
|
||||||
|
container.bind<IGitVersionTool>(TYPES.IGitVersionTool).to(GitVersionTool);
|
||||||
|
|
||||||
|
const gitVersionTool = container.get<IGitVersionTool>(TYPES.IGitVersionTool);
|
||||||
|
const buildAgent = container.get<IBuildAgent>(TYPES.IBuildAgent);
|
||||||
|
|
||||||
|
export async function setup() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
gitVersionTool.disableTelemetry();
|
||||||
|
|
||||||
|
const settings = CommonSettings.getSetupSettings(buildAgent);
|
||||||
|
|
||||||
|
await gitVersionTool.install(settings.versionSpec, settings.includePrerelease);
|
||||||
|
|
||||||
|
buildAgent.setSucceeded("GitVersion installed successfully", true);
|
||||||
|
} catch (error) {
|
||||||
|
buildAgent.setFailed(error.message, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function run() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
gitVersionTool.disableTelemetry();
|
||||||
|
|
||||||
|
const settings: GitVersionSettings = Settings.getGitVersionSettings(buildAgent);
|
||||||
|
|
||||||
|
const result = await gitVersionTool.run(settings);
|
||||||
|
|
||||||
|
const gitversion = JSON.parse(result.stdout) as GitVersionOutput;
|
||||||
|
gitVersionTool.writeGitVersionToAgent(gitversion);
|
||||||
|
|
||||||
|
if (result.code === 0) {
|
||||||
|
buildAgent.setSucceeded("GitVersion executed successfully", true);
|
||||||
|
} else {
|
||||||
|
buildAgent.setFailed(result.error.message, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
buildAgent.setFailed(error, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
4
src/tasks/gitversion/setup.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import "reflect-metadata";
|
||||||
|
import { setup } from "./main";
|
||||||
|
|
||||||
|
setup();
|
||||||
41
src/tools/gitreleasemanager/models.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
export enum CommonFields {
|
||||||
|
repository = "repository",
|
||||||
|
owner = "owner",
|
||||||
|
token = "token",
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum CreateFields {
|
||||||
|
milestone = "milestone",
|
||||||
|
releaseName = "releaseName",
|
||||||
|
inputFileName = "inputFileName",
|
||||||
|
isPreRelease = "isPreRelease",
|
||||||
|
commit = "commit",
|
||||||
|
targetDirectory = "targetDirectory",
|
||||||
|
assets = "assets",
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum DiscardFields {
|
||||||
|
milestone = "milestone",
|
||||||
|
targetDirectory = "targetDirectory",
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GitReleaseManagerSettings {
|
||||||
|
[CommonFields.repository]: string;
|
||||||
|
[CommonFields.owner]: string;
|
||||||
|
[CommonFields.token]: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GitReleaseManagerCreateSettings extends GitReleaseManagerSettings {
|
||||||
|
[CreateFields.milestone]: string;
|
||||||
|
[CreateFields.releaseName]: string;
|
||||||
|
[CreateFields.inputFileName]: string;
|
||||||
|
[CreateFields.isPreRelease]: boolean;
|
||||||
|
[CreateFields.commit]: string;
|
||||||
|
[CreateFields.targetDirectory]: string;
|
||||||
|
[CreateFields.assets]?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GitReleaseManagerDiscardSettings extends GitReleaseManagerSettings {
|
||||||
|
[DiscardFields.milestone]: string;
|
||||||
|
[DiscardFields.targetDirectory]: string;
|
||||||
|
}
|
||||||
51
src/tools/gitreleasemanager/settings.ts
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import { IBuildAgent } from "../../core/models";
|
||||||
|
import { GitReleaseManagerSettings, CommonFields, CreateFields, GitReleaseManagerCreateSettings, DiscardFields, GitReleaseManagerDiscardSettings } from "./models";
|
||||||
|
|
||||||
|
export class Settings {
|
||||||
|
|
||||||
|
public static getCreateSettings(buildAgent: IBuildAgent) : GitReleaseManagerCreateSettings {
|
||||||
|
const milestone = buildAgent.getInput(CreateFields.milestone);
|
||||||
|
const releaseName = buildAgent.getInput(CreateFields.releaseName);
|
||||||
|
const inputFileName = buildAgent.getInput(CreateFields.inputFileName);
|
||||||
|
const isPreRelease = buildAgent.getBooleanInput(CreateFields.isPreRelease);
|
||||||
|
const commit = buildAgent.getInput(CreateFields.commit);
|
||||||
|
const targetDirectory = buildAgent.getInput(CreateFields.targetDirectory);
|
||||||
|
const assets = buildAgent.getListInput(CreateFields.assets);
|
||||||
|
|
||||||
|
const commonSettings = Settings.getCommonSettings(buildAgent);
|
||||||
|
return {
|
||||||
|
...commonSettings,
|
||||||
|
milestone,
|
||||||
|
releaseName,
|
||||||
|
inputFileName,
|
||||||
|
isPreRelease,
|
||||||
|
commit,
|
||||||
|
targetDirectory,
|
||||||
|
assets
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getDiscardSettings(buildAgent: IBuildAgent) : GitReleaseManagerDiscardSettings {
|
||||||
|
const milestone = buildAgent.getInput(DiscardFields.milestone);
|
||||||
|
const targetDirectory = buildAgent.getInput(CreateFields.targetDirectory);
|
||||||
|
|
||||||
|
const commonSettings = Settings.getCommonSettings(buildAgent);
|
||||||
|
return {
|
||||||
|
...commonSettings,
|
||||||
|
milestone,
|
||||||
|
targetDirectory,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static getCommonSettings(buildAgent: IBuildAgent): GitReleaseManagerSettings {
|
||||||
|
const owner = buildAgent.getInput(CommonFields.owner, true);
|
||||||
|
const repository = buildAgent.getInput(CommonFields.repository, true);
|
||||||
|
const token = buildAgent.getInput(CommonFields.token, true);
|
||||||
|
|
||||||
|
return {
|
||||||
|
owner,
|
||||||
|
repository,
|
||||||
|
token
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
121
src/tools/gitreleasemanager/tool.ts
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
import path = require("path");
|
||||||
|
|
||||||
|
import { TYPES, IBuildAgent, IExecResult } from "../../core/models";
|
||||||
|
import { injectable, inject } from "inversify";
|
||||||
|
import { DotnetTool, IDotnetTool } from "../../core/dotnet-tool";
|
||||||
|
import { IVersionManager } from "../../core/versionManager";
|
||||||
|
|
||||||
|
import {
|
||||||
|
GitReleaseManagerSettings,
|
||||||
|
GitReleaseManagerCreateSettings,
|
||||||
|
GitReleaseManagerDiscardSettings
|
||||||
|
} from "./models";
|
||||||
|
|
||||||
|
export interface IGitReleaseManagerTool extends IDotnetTool {
|
||||||
|
install(versionSpec: string, includePrerelease: boolean): Promise<void>;
|
||||||
|
create(settings: GitReleaseManagerCreateSettings): Promise<IExecResult>;
|
||||||
|
discard(settings: GitReleaseManagerDiscardSettings): Promise<IExecResult>;
|
||||||
|
}
|
||||||
|
|
||||||
|
@injectable()
|
||||||
|
export class GitReleaseManagerTool extends DotnetTool implements IGitReleaseManagerTool {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent,
|
||||||
|
@inject(TYPES.IVersionManager) versionManager: IVersionManager
|
||||||
|
) {
|
||||||
|
super(buildAgent, versionManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async install(versionSpec: string, includePrerelease: boolean): Promise<void> {
|
||||||
|
await this.toolInstall("GitReleaseManager.Tool", versionSpec, false, includePrerelease);
|
||||||
|
}
|
||||||
|
|
||||||
|
public create(settings: GitReleaseManagerCreateSettings): Promise<IExecResult> {
|
||||||
|
const args = this.getCreateArguments(settings);
|
||||||
|
|
||||||
|
return this.execute("dotnet-gitreleasemanager", args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public discard(settings: GitReleaseManagerDiscardSettings): Promise<IExecResult> {
|
||||||
|
const args = this.getDiscardArguments(settings);
|
||||||
|
|
||||||
|
return this.execute("dotnet-gitreleasemanager", args);
|
||||||
|
}
|
||||||
|
|
||||||
|
getCommonArguments(settings: GitReleaseManagerSettings): string[] {
|
||||||
|
const args: string[] = [];
|
||||||
|
|
||||||
|
args.push("--owner", settings.owner);
|
||||||
|
args.push("--repository", settings.repository);
|
||||||
|
args.push("--token", settings.token);
|
||||||
|
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
getDiscardArguments(settings: GitReleaseManagerDiscardSettings): string[] {
|
||||||
|
const args: string[] = ['discard', ...this.getCommonArguments(settings)];
|
||||||
|
|
||||||
|
if (settings.milestone) {
|
||||||
|
args.push("--milestone", settings.milestone);
|
||||||
|
}
|
||||||
|
settings.targetDirectory = this.getRepoDir(settings.targetDirectory);
|
||||||
|
|
||||||
|
args.push("--targetDirectory", settings.targetDirectory);
|
||||||
|
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCreateArguments(settings: GitReleaseManagerCreateSettings): string[] {
|
||||||
|
const args: string[] = ['create', ...this.getCommonArguments(settings)];
|
||||||
|
|
||||||
|
if (settings.milestone) {
|
||||||
|
args.push("--milestone", settings.milestone);
|
||||||
|
}
|
||||||
|
if (settings.releaseName) {
|
||||||
|
args.push("--name", settings.releaseName);
|
||||||
|
}
|
||||||
|
if (settings.commit) {
|
||||||
|
args.push("--targetcommitish", settings.commit);
|
||||||
|
}
|
||||||
|
|
||||||
|
settings.targetDirectory = this.getRepoDir(settings.targetDirectory);
|
||||||
|
|
||||||
|
args.push("--targetDirectory", settings.targetDirectory);
|
||||||
|
|
||||||
|
if (settings.inputFileName) {
|
||||||
|
if (this.buildAgent.fileExists(settings.inputFileName)) {
|
||||||
|
args.push("--inputFilePath", settings.inputFileName);
|
||||||
|
} else {
|
||||||
|
throw new Error("GitReleaseManager inputFilePath not found at " + settings.inputFileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (settings.isPreRelease) {
|
||||||
|
args.push("--pre");
|
||||||
|
}
|
||||||
|
if (settings.assets && settings.assets.length > 0) {
|
||||||
|
settings.assets = settings.assets.map(asset => {
|
||||||
|
return path.join(settings.targetDirectory, asset)
|
||||||
|
})
|
||||||
|
|
||||||
|
args.push("--assets", settings.assets.join(","));
|
||||||
|
}
|
||||||
|
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
private getRepoDir(targetPath: string): string {
|
||||||
|
let workDir: string;
|
||||||
|
const srcDir = this.buildAgent.getSourceDir();
|
||||||
|
if (!targetPath) {
|
||||||
|
workDir = srcDir;
|
||||||
|
} else {
|
||||||
|
if (this.buildAgent.directoryExists(targetPath)) {
|
||||||
|
workDir = path.join(srcDir, targetPath);
|
||||||
|
} else {
|
||||||
|
throw new Error("Directory not found at " + targetPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return workDir.replace(/\\/g, "/");
|
||||||
|
}
|
||||||
|
}
|
||||||
52
src/tools/gitversion/models.ts
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
export enum ExecuteFields {
|
||||||
|
targetPath = "targetPath",
|
||||||
|
useConfigFile = "useConfigFile",
|
||||||
|
configFilePath = "configFilePath",
|
||||||
|
updateAssemblyInfo = "updateAssemblyInfo",
|
||||||
|
updateAssemblyInfoFilename = "updateAssemblyInfoFilename",
|
||||||
|
additionalArguments = "additionalArguments",
|
||||||
|
srcDir = "srcDir",
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface GitVersionSettings {
|
||||||
|
[ExecuteFields.targetPath]: string;
|
||||||
|
[ExecuteFields.useConfigFile]: boolean;
|
||||||
|
[ExecuteFields.configFilePath]: string;
|
||||||
|
[ExecuteFields.updateAssemblyInfo]: boolean;
|
||||||
|
[ExecuteFields.updateAssemblyInfoFilename]: string;
|
||||||
|
[ExecuteFields.additionalArguments]: string;
|
||||||
|
[ExecuteFields.srcDir]: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GitVersionOutput {
|
||||||
|
Major: number;
|
||||||
|
Minor: number;
|
||||||
|
Patch: number;
|
||||||
|
PreReleaseTag: string;
|
||||||
|
PreReleaseTagWithDash: string;
|
||||||
|
PreReleaseLabel: string;
|
||||||
|
PreReleaseNumber: number;
|
||||||
|
WeightedPreReleaseNumber: number;
|
||||||
|
BuildMetaData: number;
|
||||||
|
BuildMetaDataPadded: string;
|
||||||
|
FullBuildMetaData: string;
|
||||||
|
MajorMinorPatch: string;
|
||||||
|
SemVer: string;
|
||||||
|
LegacySemVer: string;
|
||||||
|
LegacySemVerPadded: string;
|
||||||
|
AssemblySemVer: string;
|
||||||
|
AssemblySemFileVer: string;
|
||||||
|
FullSemVer: string;
|
||||||
|
InformationalVersion: string;
|
||||||
|
BranchName: string;
|
||||||
|
Sha: string;
|
||||||
|
ShortSha: string;
|
||||||
|
NuGetVersionV2: string;
|
||||||
|
NuGetVersion: string;
|
||||||
|
NuGetPreReleaseTagV2: string;
|
||||||
|
NuGetPreReleaseTag: string;
|
||||||
|
VersionSourceSha: string;
|
||||||
|
CommitsSinceVersionSource: number;
|
||||||
|
CommitsSinceVersionSourcePadded: string;
|
||||||
|
CommitDate: string;
|
||||||
|
}
|
||||||
30
src/tools/gitversion/settings.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { IBuildAgent } from "../../core/models";
|
||||||
|
|
||||||
|
import { GitVersionSettings, ExecuteFields } from "./models";
|
||||||
|
|
||||||
|
export class Settings {
|
||||||
|
|
||||||
|
public static getGitVersionSettings(buildAgent: IBuildAgent): GitVersionSettings {
|
||||||
|
const targetPath = buildAgent.getInput(ExecuteFields.targetPath);
|
||||||
|
|
||||||
|
const useConfigFile = buildAgent.getBooleanInput(ExecuteFields.useConfigFile);
|
||||||
|
const configFilePath = buildAgent.getInput(ExecuteFields.configFilePath);
|
||||||
|
|
||||||
|
const updateAssemblyInfo = buildAgent.getBooleanInput(ExecuteFields.updateAssemblyInfo);
|
||||||
|
const updateAssemblyInfoFilename = buildAgent.getInput(ExecuteFields.updateAssemblyInfoFilename);
|
||||||
|
|
||||||
|
const additionalArguments = buildAgent.getInput(ExecuteFields.additionalArguments);
|
||||||
|
|
||||||
|
const srcDir = buildAgent.getSourceDir().replace(/\\/g, "/");
|
||||||
|
|
||||||
|
return {
|
||||||
|
targetPath,
|
||||||
|
useConfigFile,
|
||||||
|
configFilePath,
|
||||||
|
updateAssemblyInfo,
|
||||||
|
updateAssemblyInfoFilename,
|
||||||
|
additionalArguments,
|
||||||
|
srcDir,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
120
src/tools/gitversion/tool.ts
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
import path = require("path");
|
||||||
|
|
||||||
|
import { injectable, inject } from "inversify";
|
||||||
|
import { IExecResult, IBuildAgent, TYPES } from "../../core/models";
|
||||||
|
import { DotnetTool, IDotnetTool } from "../../core/dotnet-tool";
|
||||||
|
import { GitVersionSettings, GitVersionOutput, ExecuteFields } from "./models";
|
||||||
|
import { IVersionManager } from "../../core/versionManager";
|
||||||
|
|
||||||
|
export interface IGitVersionTool extends IDotnetTool {
|
||||||
|
install(versionSpec: string, includePrerelease: boolean): Promise<void>;
|
||||||
|
run(options: GitVersionSettings): Promise<IExecResult>;
|
||||||
|
writeGitVersionToAgent(gitversion: GitVersionOutput): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
@injectable()
|
||||||
|
export class GitVersionTool extends DotnetTool implements IGitVersionTool {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent,
|
||||||
|
@inject(TYPES.IVersionManager) versionManager: IVersionManager
|
||||||
|
) {
|
||||||
|
super(buildAgent, versionManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async install(versionSpec: string, includePrerelease: boolean): Promise<void> {
|
||||||
|
await this.toolInstall("GitVersion.Tool", versionSpec, false, includePrerelease);
|
||||||
|
}
|
||||||
|
|
||||||
|
public run(options: GitVersionSettings): Promise<IExecResult> {
|
||||||
|
const workDir = this.getRepoDir(options.targetPath);
|
||||||
|
|
||||||
|
const args = this.getArguments(workDir, options);
|
||||||
|
|
||||||
|
return this.execute("dotnet-gitversion", args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private getRepoDir(targetPath: string): string {
|
||||||
|
let workDir: string;
|
||||||
|
const srcDir = this.buildAgent.getSourceDir();
|
||||||
|
if (!targetPath) {
|
||||||
|
workDir = srcDir;
|
||||||
|
} else {
|
||||||
|
if (this.buildAgent.directoryExists(targetPath)) {
|
||||||
|
workDir = path.join(srcDir, targetPath);
|
||||||
|
} else {
|
||||||
|
throw new Error("Directory not found at " + targetPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return workDir.replace(/\\/g, "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
private getArguments(workDir: string, options: GitVersionSettings): string[] {
|
||||||
|
const args = [
|
||||||
|
workDir,
|
||||||
|
"/output",
|
||||||
|
"json", // need to use buildserver later
|
||||||
|
];
|
||||||
|
|
||||||
|
const {
|
||||||
|
useConfigFile,
|
||||||
|
configFilePath,
|
||||||
|
updateAssemblyInfo,
|
||||||
|
updateAssemblyInfoFilename,
|
||||||
|
additionalArguments,
|
||||||
|
} = options;
|
||||||
|
|
||||||
|
if (useConfigFile) {
|
||||||
|
if (this.buildAgent.isValidInputFile("configFilePath", configFilePath)) {
|
||||||
|
args.push("/config", configFilePath);
|
||||||
|
} else {
|
||||||
|
throw new Error("GitVersion configuration file not found at " + configFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (updateAssemblyInfo) {
|
||||||
|
args.push("/updateassemblyinfo");
|
||||||
|
if (this.buildAgent.isValidInputFile("updateAssemblyInfoFilename", updateAssemblyInfoFilename)) {
|
||||||
|
args.push(updateAssemblyInfoFilename);
|
||||||
|
} else {
|
||||||
|
throw new Error("AssemblyInfoFilename file not found at " + updateAssemblyInfoFilename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
args.push(additionalArguments);
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
public writeGitVersionToAgent(gitversion: GitVersionOutput): void {
|
||||||
|
|
||||||
|
this.buildAgent.setOutput("major", gitversion.Major.toString());
|
||||||
|
this.buildAgent.setOutput("minor", gitversion.Minor.toString());
|
||||||
|
this.buildAgent.setOutput("patch", gitversion.Patch.toString());
|
||||||
|
this.buildAgent.setOutput("preReleaseTag", gitversion.PreReleaseTag);
|
||||||
|
this.buildAgent.setOutput("preReleaseTagWithDash", gitversion.PreReleaseTagWithDash);
|
||||||
|
this.buildAgent.setOutput("preReleaseLabel", gitversion.PreReleaseLabel);
|
||||||
|
this.buildAgent.setOutput("preReleaseNumber", gitversion.PreReleaseNumber.toString());
|
||||||
|
this.buildAgent.setOutput("weightedPreReleaseNumber", gitversion.WeightedPreReleaseNumber.toString());
|
||||||
|
this.buildAgent.setOutput("buildMetaData", gitversion.BuildMetaData.toString());
|
||||||
|
this.buildAgent.setOutput("buildMetaDataPadded", gitversion.BuildMetaDataPadded);
|
||||||
|
this.buildAgent.setOutput("fullBuildMetaData", gitversion.FullBuildMetaData);
|
||||||
|
this.buildAgent.setOutput("majorMinorPatch", gitversion.MajorMinorPatch);
|
||||||
|
this.buildAgent.setOutput("semVer", gitversion.SemVer);
|
||||||
|
this.buildAgent.setOutput("legacySemVer", gitversion.LegacySemVer);
|
||||||
|
this.buildAgent.setOutput("legacySemVerPadded", gitversion.LegacySemVerPadded);
|
||||||
|
this.buildAgent.setOutput("assemblySemVer", gitversion.AssemblySemVer);
|
||||||
|
this.buildAgent.setOutput("assemblySemFileVer", gitversion.AssemblySemFileVer);
|
||||||
|
this.buildAgent.setOutput("fullSemVer", gitversion.FullSemVer);
|
||||||
|
this.buildAgent.setOutput("informationalVersion", gitversion.InformationalVersion);
|
||||||
|
this.buildAgent.setOutput("branchName", gitversion.BranchName);
|
||||||
|
this.buildAgent.setOutput("sha", gitversion.Sha);
|
||||||
|
this.buildAgent.setOutput("shortSha", gitversion.ShortSha);
|
||||||
|
this.buildAgent.setOutput("nuGetVersionV2", gitversion.NuGetVersionV2);
|
||||||
|
this.buildAgent.setOutput("nuGetVersion", gitversion.NuGetVersion);
|
||||||
|
this.buildAgent.setOutput("nuGetPreReleaseTagV2", gitversion.NuGetPreReleaseTagV2);
|
||||||
|
this.buildAgent.setOutput("nuGetPreReleaseTag", gitversion.NuGetPreReleaseTag);
|
||||||
|
this.buildAgent.setOutput("versionSourceSha", gitversion.VersionSourceSha);
|
||||||
|
this.buildAgent.setOutput("commitsSinceVersionSource", gitversion.CommitsSinceVersionSource.toString());
|
||||||
|
this.buildAgent.setOutput("commitsSinceVersionSourcePadded", gitversion.CommitsSinceVersionSourcePadded);
|
||||||
|
this.buildAgent.setOutput("commitDate", gitversion.CommitDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
14
tsconfig.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "CommonJS",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"target": "ES2016",
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"lib": ["ES2016"],
|
||||||
|
"types": ["reflect-metadata"],
|
||||||
|
"esModuleInterop":true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true
|
||||||
|
}
|
||||||
|
}
|
||||||
14
tslint.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"defaultSeverity": "error",
|
||||||
|
"extends": [
|
||||||
|
"tslint:recommended"
|
||||||
|
],
|
||||||
|
"jsRules": {},
|
||||||
|
"rules": {
|
||||||
|
"max-classes-per-file":false,
|
||||||
|
"no-console":false,
|
||||||
|
"no-var-requires":false,
|
||||||
|
"object-literal-sort-keys":false
|
||||||
|
},
|
||||||
|
"rulesDirectory": []
|
||||||
|
}
|
||||||
59
webpack.config.js
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const ReplaceInFileWebpackPlugin = require('replace-in-file-webpack-plugin');
|
||||||
|
|
||||||
|
module.exports = (env) => {
|
||||||
|
const mode = env.mode || 'development';
|
||||||
|
const agent = env.agent || 'mock';
|
||||||
|
|
||||||
|
return {
|
||||||
|
entry: {
|
||||||
|
'gitversion/setup': path.resolve(__dirname, 'src/tasks/gitversion/setup.ts'),
|
||||||
|
'gitversion/execute': path.resolve(__dirname, 'src/tasks/gitversion/execute.ts'),
|
||||||
|
'gitreleasemanager/setup': path.resolve(__dirname, 'src/tasks/gitreleasemanager/setup.ts'),
|
||||||
|
'gitreleasemanager/create': path.resolve(__dirname, 'src/tasks/gitreleasemanager/create.ts'),
|
||||||
|
'gitreleasemanager/discard': path.resolve(__dirname, 'src/tasks/gitreleasemanager/discard.ts'),
|
||||||
|
},
|
||||||
|
target: 'node',
|
||||||
|
mode: mode,
|
||||||
|
devtool: mode == 'development' ? 'inline-source-map' : false,
|
||||||
|
module: {
|
||||||
|
rules: [{
|
||||||
|
test: /\.tsx?$/,
|
||||||
|
use: 'ts-loader',
|
||||||
|
exclude: /node_modules/,
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.tsx', '.ts', '.js', '.json'],
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
libraryTarget: 'commonjs2',
|
||||||
|
filename: '[name]/bundle.js',
|
||||||
|
path: path.resolve(__dirname, `dist/${agent}`),
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.NormalModuleReplacementPlugin(
|
||||||
|
/agent\/mock\/build-agent/,
|
||||||
|
`../agent/${agent}/build-agent`
|
||||||
|
),
|
||||||
|
new ReplaceInFileWebpackPlugin([{
|
||||||
|
dir: `dist/${agent}`,
|
||||||
|
test: /bundle.js/,
|
||||||
|
rules: [{
|
||||||
|
search: /__webpack_require__\(.*\)\(resourceFile\)/,
|
||||||
|
replace: 'require(resourceFile)'
|
||||||
|
}, {
|
||||||
|
search: /call\(this, \"\/\"\)\)/gi,
|
||||||
|
replace: "call(this, __dirname))"
|
||||||
|
}, {
|
||||||
|
search: /let pkg.*'package.json'\)\);/,
|
||||||
|
replace: ''
|
||||||
|
}, {
|
||||||
|
search: /let userAgent = 'vsts-task-installer\/' \+ pkg.version;/,
|
||||||
|
replace: "let userAgent = 'vsts-task-installer'"
|
||||||
|
}]
|
||||||
|
}])
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||