4 Commits

Author SHA1 Message Date
Artur
e8d218bb9b dist update 2023-03-11 12:26:15 +01:00
Artur
813383bdba Revert "Merge pull request #812 from GitTools/bug/prerelease"
This reverts commit a6b18fd71f.
2023-03-11 12:23:21 +01:00
Artur
b73575fafe Revert "Merge pull request #813 from GitTools/bug/730"
This reverts commit 364926b235.
2023-03-11 12:23:10 +01:00
Artur
ae4777b171 Revert "Merge pull request #814 from GitTools/feature/691"
This reverts commit 20cee55108.
2023-03-11 12:22:08 +01:00
84 changed files with 61759 additions and 125237 deletions

View File

@@ -8,7 +8,6 @@ end_of_line = lf
charset = utf-8 charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
max_line_length = off
[*.yml] [*.yml]
indent_size = 2 indent_size = 2

2
.gitignore vendored
View File

@@ -4,5 +4,3 @@ node_modules/
*.js *.js
!dist/**/*.js !dist/**/*.js
*.vsix *.vsix
.idea/

View File

@@ -1,5 +1,5 @@
{ {
"printWidth": 160, "printWidth": 80,
"tabWidth": 4, "tabWidth": 4,
"useTabs": false, "useTabs": false,
"semi": false, "semi": false,

File diff suppressed because one or more lines are too long

View File

@@ -21,54 +21,47 @@
} }
}, },
"instanceNameFormat": "gitreleasemanager/addasset", "instanceNameFormat": "gitreleasemanager/addasset",
"inputs": [ "inputs": [{
{ "name": "owner",
"name": "owner", "type": "string",
"type": "string", "label": "The owner of the repository",
"label": "The owner of the repository", "defaultValue": "",
"defaultValue": "", "required": true,
"required": true, "helpMarkDown": "The owner of the repository"
"helpMarkDown": "The owner of the repository" }, {
}, "name": "repository",
{ "type": "string",
"name": "repository", "label": "The name of the repository",
"type": "string", "defaultValue": "",
"label": "The name of the repository", "required": true,
"defaultValue": "", "helpMarkDown": "The name of the repository"
"required": true, }, {
"helpMarkDown": "The name of the repository" "name": "token",
}, "type": "string",
{ "label": "The access token to access GitHub with",
"name": "token", "defaultValue": "",
"type": "string", "required": true,
"label": "The access token to access GitHub with", "helpMarkDown": "The access token to access GitHub with"
"defaultValue": "", }, {
"required": true, "name": "tagName",
"helpMarkDown": "The access token to access GitHub with" "type": "string",
}, "label": "The name of the release",
{ "defaultValue": "",
"name": "tagName", "required": true,
"type": "string", "helpMarkDown": "The name of the release"
"label": "The name of the release", }, {
"defaultValue": "", "name": "assets",
"required": true, "type": "multiLine",
"helpMarkDown": "The name of the release" "label": "Path(s) to the file(s) to include in the release",
}, "defaultValue": "",
{ "required": false,
"name": "assets", "helpMarkDown": "Path(s) to the file(s) to include in the release. Separated by newline"
"type": "multiLine", }, {
"label": "Path(s) to the file(s) to include in the release", "name": "targetDirectory",
"defaultValue": "", "type": "string",
"required": false, "label": "The directory on which GitReleaseManager should be executed. Defaults to current directory",
"helpMarkDown": "Path(s) to the file(s) to include in the release. Separated by newline" "defaultValue": "",
}, "required": false,
{ "helpMarkDown": "The directory on which GitReleaseManager should be executed. Defaults to current directory"
"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"
}
]
} }

File diff suppressed because one or more lines are too long

View File

@@ -21,46 +21,40 @@
} }
}, },
"instanceNameFormat": "gitreleasemanager/close", "instanceNameFormat": "gitreleasemanager/close",
"inputs": [ "inputs": [{
{ "name": "owner",
"name": "owner", "type": "string",
"type": "string", "label": "The owner of the repository",
"label": "The owner of the repository", "defaultValue": "",
"defaultValue": "", "required": true,
"required": true, "helpMarkDown": "The owner of the repository"
"helpMarkDown": "The owner of the repository" }, {
}, "name": "repository",
{ "type": "string",
"name": "repository", "label": "The name of the repository",
"type": "string", "defaultValue": "",
"label": "The name of the repository", "required": true,
"defaultValue": "", "helpMarkDown": "The name of the repository"
"required": true, }, {
"helpMarkDown": "The name of the repository" "name": "token",
}, "type": "string",
{ "label": "The access token to access GitHub with",
"name": "token", "defaultValue": "",
"type": "string", "required": true,
"label": "The access token to access GitHub with", "helpMarkDown": "The access token to access GitHub with"
"defaultValue": "", }, {
"required": true, "name": "milestone",
"helpMarkDown": "The access token to access GitHub with" "type": "string",
}, "label": "The milestone to use",
{ "defaultValue": "",
"name": "milestone", "required": true,
"type": "string", "helpMarkDown": "The milestone to use"
"label": "The milestone to use", }, {
"defaultValue": "", "name": "targetDirectory",
"required": true, "type": "string",
"helpMarkDown": "The milestone to use" "label": "The directory on which GitReleaseManager should be executed. Defaults to current directory",
}, "defaultValue": "",
{ "required": false,
"name": "targetDirectory", "helpMarkDown": "The directory on which GitReleaseManager should be executed. Defaults to current directory"
"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"
}
]
} }

File diff suppressed because one or more lines are too long

View File

@@ -21,86 +21,75 @@
} }
}, },
"instanceNameFormat": "gitreleasemanager/create", "instanceNameFormat": "gitreleasemanager/create",
"inputs": [ "inputs": [{
{ "name": "owner",
"name": "owner", "type": "string",
"type": "string", "label": "The owner of the repository",
"label": "The owner of the repository", "defaultValue": "",
"defaultValue": "", "required": true,
"required": true, "helpMarkDown": "The owner of the repository"
"helpMarkDown": "The owner of the repository" }, {
}, "name": "repository",
{ "type": "string",
"name": "repository", "label": "The name of the repository",
"type": "string", "defaultValue": "",
"label": "The name of the repository", "required": true,
"defaultValue": "", "helpMarkDown": "The name of the repository"
"required": true, }, {
"helpMarkDown": "The name of the repository" "name": "token",
}, "type": "string",
{ "label": "The access token to access GitHub with",
"name": "token", "defaultValue": "",
"type": "string", "required": true,
"label": "The access token to access GitHub with", "helpMarkDown": "The access token to access GitHub with"
"defaultValue": "", }, {
"required": true, "name": "milestone",
"helpMarkDown": "The access token to access GitHub with" "type": "string",
}, "label": "The milestone to use",
{ "defaultValue": "",
"name": "milestone", "required": false,
"type": "string", "helpMarkDown": "The milestone to use"
"label": "The milestone to use", }, {
"defaultValue": "", "name": "name",
"required": false, "type": "string",
"helpMarkDown": "The milestone to use" "label": "The name of the release",
}, "defaultValue": "",
{ "required": false,
"name": "name", "helpMarkDown": "The name of the release"
"type": "string", }, {
"label": "The name of the release", "name": "inputFilePath",
"defaultValue": "", "type": "string",
"required": false, "label": "The path to the file to be used as the content of the release notes",
"helpMarkDown": "The name of the release" "defaultValue": "",
}, "required": false,
{ "helpMarkDown": "The path to the file to be used as the content of the release notes"
"name": "inputFilePath", }, {
"type": "string", "name": "isPreRelease",
"label": "The path to the file to be used as the content of the release notes", "type": "boolean",
"defaultValue": "", "label": "Creates the release as a pre-release",
"required": false, "defaultValue": "false",
"helpMarkDown": "The path to the file to be used as the content of the release notes" "required": false,
}, "helpMarkDown": "Creates the release as a pre-release"
{ }, {
"name": "isPreRelease", "name": "targetcommitish",
"type": "boolean", "type": "string",
"label": "Creates the release as a pre-release", "label": "The commit to tag. Can be a branch or SHA. Defaults to repository's default branch",
"defaultValue": "false", "defaultValue": "",
"required": false, "required": false,
"helpMarkDown": "Creates the release as a pre-release" "helpMarkDown": "The commit to tag. Can be a branch or SHA. Defaults to repository's default branch"
}, }, {
{ "name": "targetDirectory",
"name": "targetcommitish", "type": "string",
"type": "string", "label": "The directory on which GitReleaseManager should be executed. Defaults to current directory",
"label": "The commit to tag. Can be a branch or SHA. Defaults to repository's default branch", "defaultValue": "",
"defaultValue": "", "required": false,
"required": false, "helpMarkDown": "The directory on which GitReleaseManager should be executed. Defaults to current directory"
"helpMarkDown": "The commit to tag. Can be a branch or SHA. Defaults to repository's default branch" }, {
}, "name": "assets",
{ "type": "multiLine",
"name": "targetDirectory", "label": "Path(s) to the file(s) to include in the release",
"type": "string", "defaultValue": "",
"label": "The directory on which GitReleaseManager should be executed. Defaults to current directory", "required": false,
"defaultValue": "", "helpMarkDown": "Path(s) to the file(s) to include in the release. Separated by newline"
"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"
}
]
} }

File diff suppressed because one or more lines are too long

View File

@@ -21,46 +21,40 @@
} }
}, },
"instanceNameFormat": "gitreleasemanager/discard", "instanceNameFormat": "gitreleasemanager/discard",
"inputs": [ "inputs": [{
{ "name": "owner",
"name": "owner", "type": "string",
"type": "string", "label": "The owner of the repository",
"label": "The owner of the repository", "defaultValue": "",
"defaultValue": "", "required": true,
"required": true, "helpMarkDown": "The owner of the repository"
"helpMarkDown": "The owner of the repository" }, {
}, "name": "repository",
{ "type": "string",
"name": "repository", "label": "The name of the repository",
"type": "string", "defaultValue": "",
"label": "The name of the repository", "required": true,
"defaultValue": "", "helpMarkDown": "The name of the repository"
"required": true, }, {
"helpMarkDown": "The name of the repository" "name": "token",
}, "type": "string",
{ "label": "The access token to access GitHub with",
"name": "token", "defaultValue": "",
"type": "string", "required": true,
"label": "The access token to access GitHub with", "helpMarkDown": "The access token to access GitHub with"
"defaultValue": "", }, {
"required": true, "name": "milestone",
"helpMarkDown": "The access token to access GitHub with" "type": "string",
}, "label": "The milestone to use",
{ "defaultValue": "",
"name": "milestone", "required": true,
"type": "string", "helpMarkDown": "The milestone to use"
"label": "The milestone to use", }, {
"defaultValue": "", "name": "targetDirectory",
"required": true, "type": "string",
"helpMarkDown": "The milestone to use" "label": "The directory on which GitReleaseManager should be executed. Defaults to current directory",
}, "defaultValue": "",
{ "required": false,
"name": "targetDirectory", "helpMarkDown": "The directory on which GitReleaseManager should be executed. Defaults to current directory"
"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"
}
]
} }

File diff suppressed because one or more lines are too long

View File

@@ -21,46 +21,40 @@
} }
}, },
"instanceNameFormat": "gitreleasemanager/open", "instanceNameFormat": "gitreleasemanager/open",
"inputs": [ "inputs": [{
{ "name": "owner",
"name": "owner", "type": "string",
"type": "string", "label": "The owner of the repository",
"label": "The owner of the repository", "defaultValue": "",
"defaultValue": "", "required": true,
"required": true, "helpMarkDown": "The owner of the repository"
"helpMarkDown": "The owner of the repository" }, {
}, "name": "repository",
{ "type": "string",
"name": "repository", "label": "The name of the repository",
"type": "string", "defaultValue": "",
"label": "The name of the repository", "required": true,
"defaultValue": "", "helpMarkDown": "The name of the repository"
"required": true, }, {
"helpMarkDown": "The name of the repository" "name": "token",
}, "type": "string",
{ "label": "The access token to access GitHub with",
"name": "token", "defaultValue": "",
"type": "string", "required": true,
"label": "The access token to access GitHub with", "helpMarkDown": "The access token to access GitHub with"
"defaultValue": "", }, {
"required": true, "name": "milestone",
"helpMarkDown": "The access token to access GitHub with" "type": "string",
}, "label": "The milestone to use",
{ "defaultValue": "",
"name": "milestone", "required": true,
"type": "string", "helpMarkDown": "The milestone to use"
"label": "The milestone to use", }, {
"defaultValue": "", "name": "targetDirectory",
"required": true, "type": "string",
"helpMarkDown": "The milestone to use" "label": "The directory on which GitReleaseManager should be executed. Defaults to current directory",
}, "defaultValue": "",
{ "required": false,
"name": "targetDirectory", "helpMarkDown": "The directory on which GitReleaseManager should be executed. Defaults to current directory"
"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"
}
]
} }

File diff suppressed because one or more lines are too long

View File

@@ -21,46 +21,40 @@
} }
}, },
"instanceNameFormat": "gitreleasemanager/publish", "instanceNameFormat": "gitreleasemanager/publish",
"inputs": [ "inputs": [{
{ "name": "owner",
"name": "owner", "type": "string",
"type": "string", "label": "The owner of the repository",
"label": "The owner of the repository", "defaultValue": "",
"defaultValue": "", "required": true,
"required": true, "helpMarkDown": "The owner of the repository"
"helpMarkDown": "The owner of the repository" }, {
}, "name": "repository",
{ "type": "string",
"name": "repository", "label": "The name of the repository",
"type": "string", "defaultValue": "",
"label": "The name of the repository", "required": true,
"defaultValue": "", "helpMarkDown": "The name of the repository"
"required": true, }, {
"helpMarkDown": "The name of the repository" "name": "token",
}, "type": "string",
{ "label": "The access token to access GitHub with",
"name": "token", "defaultValue": "",
"type": "string", "required": true,
"label": "The access token to access GitHub with", "helpMarkDown": "The access token to access GitHub with"
"defaultValue": "", }, {
"required": true, "name": "tagName",
"helpMarkDown": "The access token to access GitHub with" "type": "string",
}, "label": "The name of the release",
{ "defaultValue": "",
"name": "tagName", "required": true,
"type": "string", "helpMarkDown": "The name of the release"
"label": "The name of the release", }, {
"defaultValue": "", "name": "targetDirectory",
"required": true, "type": "string",
"helpMarkDown": "The name of the release" "label": "The directory on which GitReleaseManager should be executed. Defaults to current directory",
}, "defaultValue": "",
{ "required": false,
"name": "targetDirectory", "helpMarkDown": "The directory on which GitReleaseManager should be executed. Defaults to current directory"
"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"
}
]
} }

File diff suppressed because one or more lines are too long

View File

@@ -21,8 +21,7 @@
} }
}, },
"instanceNameFormat": "gitreleasemanager/setup", "instanceNameFormat": "gitreleasemanager/setup",
"inputs": [ "inputs": [{
{
"name": "versionSpec", "name": "versionSpec",
"type": "string", "type": "string",
"label": "The version spec", "label": "The version spec",
@@ -45,14 +44,6 @@
"defaultValue": "false", "defaultValue": "false",
"required": false, "required": false,
"helpMarkDown": "Treat package source failures as warnings" "helpMarkDown": "Treat package source failures as warnings"
},
{
"name": "preferLatestVersion",
"type": "boolean",
"label": "Prefer latest version",
"defaultValue": "false",
"required": false,
"helpMarkDown": "Prefer to download the latest version matching the versionSpec, even if there is a local cached version."
} }
] ]
} }

File diff suppressed because one or more lines are too long

View File

@@ -21,8 +21,7 @@
} }
}, },
"instanceNameFormat": "gitversion/execute", "instanceNameFormat": "gitversion/execute",
"groups": [ "groups": [{
{
"name": "gitversionDetails", "name": "gitversionDetails",
"displayName": "GitVersion details", "displayName": "GitVersion details",
"isExpanded": true "isExpanded": true
@@ -33,8 +32,7 @@
"isExpanded": false "isExpanded": false
} }
], ],
"inputs": [ "inputs": [{
{
"name": "targetPath", "name": "targetPath",
"type": "string", "type": "string",
"label": "Working directory path", "label": "Working directory path",

File diff suppressed because one or more lines are too long

View File

@@ -21,8 +21,7 @@
} }
}, },
"instanceNameFormat": "gitversion/setup", "instanceNameFormat": "gitversion/setup",
"inputs": [ "inputs": [{
{
"name": "versionSpec", "name": "versionSpec",
"type": "string", "type": "string",
"label": "The version spec", "label": "The version spec",
@@ -45,14 +44,6 @@
"defaultValue": "false", "defaultValue": "false",
"required": false, "required": false,
"helpMarkDown": "Treat package source failures as warnings" "helpMarkDown": "Treat package source failures as warnings"
},
{
"name": "preferLatestVersion",
"type": "boolean",
"label": "Prefer latest version",
"defaultValue": "false",
"required": false,
"helpMarkDown": "Prefer to download the latest version matching the versionSpec, even if there is a local cached version."
} }
] ]
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -2,7 +2,7 @@
```yaml ```yaml
steps: steps:
- task: gitreleasemanager/close@0 - task: gitreleasemanager/close@0
inputs: inputs:
token: '$(GITHUB_TOKEN)' token: '$(GITHUB_TOKEN)'
owner: 'someOwner' owner: 'someOwner'

View File

@@ -2,7 +2,7 @@
```yaml ```yaml
steps: steps:
- task: gitreleasemanager/open@0 - task: gitreleasemanager/open@0
inputs: inputs:
token: '$(GITHUB_TOKEN)' token: '$(GITHUB_TOKEN)'
owner: 'someOwner' owner: 'someOwner'

View File

@@ -226,19 +226,18 @@ steps:
Calculate the version for the build and use the `GitVersion.BranchName` variable in a condition for starting another job. Calculate the version for the build and use the `GitVersion.BranchName` variable in a condition for starting another job.
```yaml ```yaml
jobs: job: CalculateVersion
- job: CalculateVersion displayName: Calculate version using GitVersion
displayName: Calculate version using GitVersion steps:
steps: # gitversion/setup@0 task omitted for brevity.
# gitversion/setup@0 task omitted for brevity.
- task: gitversion/execute@0 - task: gitversion/execute@0
displayName: Use GitVersion displayName: Use GitVersion
name: Version # the step MUST be named to access its output variables in another job. name: Version # the step MUST be named to access its output variables in another job.
- job: CreateReleaseNotes job: CreateReleaseNotes
condition: and(succeeded(), eq(dependencies.CalculateVersion.outputs['Version.GitVersion.BranchName'], 'main')) condition: and(succeeded(), eq(dependencies.CalculateVersion.outputs['Version.GitVersion.BranchName'], 'main'))
dependsOn: CalculateVersion dependsOn: CalculateVersion
``` ```
### Example 8 ### Example 8
@@ -246,19 +245,18 @@ jobs:
Calculate the version for the build and map the `GitVersion.SemVer` variable into a variable in another job. Calculate the version for the build and map the `GitVersion.SemVer` variable into a variable in another job.
```yaml ```yaml
jobs: job: CalculateVersion
- job: CalculateVersion displayName: Calculate version using GitVersion
displayName: Calculate version using GitVersion steps:
steps: # gitversion/setup@0 task omitted for brevity.
# gitversion/setup@0 task omitted for brevity.
- task: gitversion/execute@0 - task: gitversion/execute@0
displayName: Use GitVersion displayName: Use GitVersion
name: Version # the step MUST be named to access its output variables in another job. name: Version # the step MUST be named to access its output variables in another job.
- job: BuildAndPack job: BuildAndPack
variables: variables:
Ver.MajorMinorPatch: $[ dependencies.CalculateVersion.outputs['Version.GitVersion.MajorMinorPatch'] ] Ver.MajorMinorPatch: $[ dependencies.CalculateVersion.outputs['Version.GitVersion.MajorMinorPatch'] ]
``` ```
### Example 9 ### Example 9

View File

@@ -21,10 +21,6 @@ ignoreFailedSources:
description: Treat package source failures as warnings. description: Treat package source failures as warnings.
required: false required: false
default: false default: false
preferLatestVersion:
description: Prefer to download the latest version matching the versionSpec, even if there is a local cached version.
required: false
default: 'false'
``` ```
--- ---
@@ -67,16 +63,3 @@ steps:
versionSpec: '6.x' versionSpec: '6.x'
includePrerelease: true includePrerelease: true
``` ```
### Example 4
Install the latest GitVersion 5 version even it there is a cached version matching the versionSpec.
```yaml
steps:
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '5.x'
preferLatestVersion: true
```

View File

@@ -2,7 +2,7 @@
```yaml ```yaml
steps: steps:
- uses: gittools/actions/gitreleasemanager/addassetv0 - uses: gittools/actions/gitreleasemanager/addasset@v0.9.2
name: Add asset to a release with GitReleaseManager name: Add asset to a release with GitReleaseManager
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -2,7 +2,7 @@
```yaml ```yaml
steps: steps:
- uses: gittools/actions/gitreleasemanager/closev0 - uses: gittools/actions/gitreleasemanager/close@v0.9.2
name: Close release with GitReleaseManager name: Close release with GitReleaseManager
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -2,7 +2,7 @@
```yaml ```yaml
steps: steps:
- uses: gittools/actions/gitreleasemanager/createv0 - uses: gittools/actions/gitreleasemanager/create@v0.9.2
name: Create release with GitReleaseManager name: Create release with GitReleaseManager
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -2,7 +2,7 @@
```yaml ```yaml
steps: steps:
- uses: gittools/actions/gitreleasemanager/discardv0 - uses: gittools/actions/gitreleasemanager/discard@v0.9.2
name: Discard release with GitReleaseManager name: Discard release with GitReleaseManager
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -2,7 +2,7 @@
```yaml ```yaml
steps: steps:
- uses: gittools/actions/gitreleasemanager/openv0 - uses: gittools/actions/gitreleasemanager/open@v0.9.2
name: Open release with GitReleaseManager name: Open release with GitReleaseManager
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -2,7 +2,7 @@
```yaml ```yaml
steps: steps:
- uses: gittools/actions/gitreleasemanager/publishv0 - uses: gittools/actions/gitreleasemanager/publish@v0.9.2
name: Publish release with GitReleaseManager name: Publish release with GitReleaseManager
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -2,7 +2,7 @@
```yaml ```yaml
steps: steps:
- uses: gittools/actions/gitreleasemanager/setupv0 - uses: gittools/actions/gitreleasemanager/setup@v0.9.2
name: Install GitReleaseManager name: Install GitReleaseManager
with: with:
versionSpec: '0.10.x' versionSpec: '0.10.x'

View File

@@ -100,10 +100,10 @@ Calculate the version for the build.
```yaml ```yaml
steps: steps:
# gitversion/setup@v0 action omitted for brevity. # gitversion/setup@v0.9.7 action omitted for brevity.
- name: Determine Version - name: Determine Version
uses: gittools/actions/gitversion/execute@v0 uses: gittools/actions/gitversion/execute@v0.9.7
``` ```
### Example 2 ### Example 2
@@ -113,7 +113,7 @@ Calculate the version for the build using a config file with the default name **
```yaml ```yaml
steps: steps:
- name: Determine Version - name: Determine Version
uses: gittools/actions/gitversion/execute@v0 uses: gittools/actions/gitversion/execute@v0.9.7
with: with:
useConfigFile: true useConfigFile: true
``` ```
@@ -135,10 +135,10 @@ Calculate the version for the build using a config file named **VersionConfig.ym
```yaml ```yaml
steps: steps:
# gitversion/setup@v0 action omitted for brevity. # gitversion/setup@v0.9.7 action omitted for brevity.
- name: Determine Version - name: Determine Version
uses: gittools/actions/gitversion/execute@v0 uses: gittools/actions/gitversion/execute@v0.9.7
with: with:
useConfigFile: true useConfigFile: true
configFilePath: VersionConfig.yml configFilePath: VersionConfig.yml
@@ -150,10 +150,10 @@ Show the effective configuration for GitVersion by running the **/showConfig** c
```yaml ```yaml
steps: steps:
# gitversion/setup@v0 action omitted for brevity. # gitversion/setup@v0.9.7 action omitted for brevity.
- name: Display GitVersion config - name: Display GitVersion config
uses: gittools/actions/gitversion/execute@v0 uses: gittools/actions/gitversion/execute@v0.9.7
with: with:
useConfigFile: true useConfigFile: true
additionalArguments: '/showConfig' additionalArguments: '/showConfig'
@@ -165,11 +165,11 @@ Calculate the version for the build and display all the calculated variables in
```yaml ```yaml
steps: steps:
# gitversion/setup@v0 action omitted for brevity. # gitversion/setup@v0.9.7 action omitted for brevity.
- name: Determine Version - name: Determine Version
id: gitversion id: gitversion
uses: gittools/actions/gitversion/execute@v0 uses: gittools/actions/gitversion/execute@v0.9.7
- name: Display GitVersion outputs - name: Display GitVersion outputs
run: | run: |
@@ -213,10 +213,10 @@ Calculate the version for the build and display the value of the `GITVERSION_SEM
```yaml ```yaml
steps: steps:
# gitversion/setup@v0 action omitted for brevity. # gitversion/setup@v0.9.7 action omitted for brevity.
- name: Determine Version - name: Determine Version
uses: gittools/actions/gitversion/execute@v0 uses: gittools/actions/gitversion/execute@v0.9.7
- name: Display SemVer - name: Display SemVer
run: | run: |
@@ -239,7 +239,7 @@ jobs:
- name: Determine Version - name: Determine Version
id: gitversion id: gitversion
uses: gittools/actions/gitversion/execute@v0 uses: gittools/actions/gitversion/execute@v0.9.7
create-release-notes: create-release-notes:
name: Create Release Notes name: Create Release Notes
@@ -268,7 +268,7 @@ jobs:
- name: Determine Version - name: Determine Version
id: gitversion id: gitversion
uses: gittools/actions/gitversion/execute@v0 uses: gittools/actions/gitversion/execute@v0.9.7
display-semver: display-semver:
name: Display Semantic Version name: Display Semantic Version

View File

@@ -34,7 +34,7 @@ Install the latest GitVersion 5 version.
```yaml ```yaml
steps: steps:
- name: Install GitVersion - name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0 uses: gittools/actions/gitversion/setup@v0.9.7
with: with:
versionSpec: '5.x' versionSpec: '5.x'
``` ```
@@ -46,7 +46,7 @@ Install GitVersion 5.5.0.
```yaml ```yaml
steps: steps:
- name: Install GitVersion - name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0 uses: gittools/actions/gitversion/setup@v0.9.7
with: with:
versionSpec: '5.5.0' versionSpec: '5.5.0'
``` ```
@@ -58,21 +58,8 @@ Install the latest GitVersion 6 pre-release version. For example **6.0.0-beta1.
```yaml ```yaml
steps: steps:
- name: Install GitVersion - name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0 uses: gittools/actions/gitversion/setup@v0.9.7
with: with:
versionSpec: '6.x' versionSpec: '6.x'
includePrerelease: true includePrerelease: true
``` ```
### Example 4
Install the latest GitVersion 5 version even it there is a cached version matching the versionSpec.
```yaml
steps:
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
preferLatestVersion: true
```

View File

@@ -20,7 +20,3 @@ inputs:
description: Treat package source failures as warnings. description: Treat package source failures as warnings.
required: false required: false
default: 'false' default: 'false'
preferLatestVersion:
description: Prefer to download the latest version matching the versionSpec, even if there is a local cached version.
required: false
default: 'false'

View File

@@ -20,7 +20,3 @@ inputs:
description: Treat package source failures as warnings. description: Treat package source failures as warnings.
required: false required: false
default: 'false' default: 'false'
preferLatestVersion:
description: Prefer to download the latest version matching the versionSpec, even if there is a local cached version.
required: false
default: 'false'

246
package-lock.json generated
View File

@@ -16,14 +16,13 @@
"azure-pipelines-task-lib": "^4.3.0", "azure-pipelines-task-lib": "^4.3.0",
"azure-pipelines-tool-lib": "^1.3.2", "azure-pipelines-tool-lib": "^1.3.2",
"inversify": "^6.0.1", "inversify": "^6.0.1",
"semver": "^7.3.8",
"typed-rest-client": "^1.8.9", "typed-rest-client": "^1.8.9",
"uuid": "^9.0.0" "uuid": "^9.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^18.15.0", "@types/node": "^18.15.0",
"@types/q": "^1.5.5", "@types/q": "^1.5.5",
"@types/semver": "^7.3.13", "@types/semver-compare": "^1.0.1",
"@types/uuid": "^9.0.1", "@types/uuid": "^9.0.1",
"minimist": "^1.2.8", "minimist": "^1.2.8",
"prettier": "^2.8.4", "prettier": "^2.8.4",
@@ -287,9 +286,14 @@
"integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA==" "integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA=="
}, },
"node_modules/@types/semver": { "node_modules/@types/semver": {
"version": "7.3.13", "version": "5.5.0",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", "integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ=="
},
"node_modules/@types/semver-compare": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/semver-compare/-/semver-compare-1.0.1.tgz",
"integrity": "sha512-wx2LQVvKlEkhXp/HoKIZ/aSL+TvfJdKco8i0xJS3aR877mg4qBHzNT6+B5a61vewZHo79EdZavskGnRXEC2H6A==",
"dev": true "dev": true
}, },
"node_modules/@types/uuid": { "node_modules/@types/uuid": {
@@ -658,14 +662,6 @@
"uuid": "^3.0.1" "uuid": "^3.0.1"
} }
}, },
"node_modules/azure-pipelines-task-lib/node_modules/semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"bin": {
"semver": "bin/semver"
}
},
"node_modules/azure-pipelines-task-lib/node_modules/uuid": { "node_modules/azure-pipelines-task-lib/node_modules/uuid": {
"version": "3.4.0", "version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
@@ -688,11 +684,6 @@
"uuid": "^3.3.2" "uuid": "^3.3.2"
} }
}, },
"node_modules/azure-pipelines-tool-lib/node_modules/@types/semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ=="
},
"node_modules/azure-pipelines-tool-lib/node_modules/@types/uuid": { "node_modules/azure-pipelines-tool-lib/node_modules/@types/uuid": {
"version": "3.4.9", "version": "3.4.9",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.9.tgz", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.9.tgz",
@@ -717,14 +708,6 @@
"resolved": "https://registry.npmjs.org/mockery/-/mockery-1.7.0.tgz", "resolved": "https://registry.npmjs.org/mockery/-/mockery-1.7.0.tgz",
"integrity": "sha512-gUQA33ayi0tuAhr/rJNZPr7Q7uvlBt4gyJPbi0CDcAfIzIrDu1YgGMFgmAu3stJqBpK57m7+RxUbcS+pt59fKQ==" "integrity": "sha512-gUQA33ayi0tuAhr/rJNZPr7Q7uvlBt4gyJPbi0CDcAfIzIrDu1YgGMFgmAu3stJqBpK57m7+RxUbcS+pt59fKQ=="
}, },
"node_modules/azure-pipelines-tool-lib/node_modules/semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"bin": {
"semver": "bin/semver"
}
},
"node_modules/azure-pipelines-tool-lib/node_modules/uuid": { "node_modules/azure-pipelines-tool-lib/node_modules/uuid": {
"version": "3.4.0", "version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
@@ -2135,6 +2118,39 @@
"validate-npm-package-license": "^3.0.1" "validate-npm-package-license": "^3.0.1"
} }
}, },
"node_modules/normalize-package-data/node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/normalize-package-data/node_modules/semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/normalize-package-data/node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
},
"node_modules/normalize-path": { "node_modules/normalize-path": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
@@ -2516,15 +2532,6 @@
"validate-npm-package-license": "^3.0.1" "validate-npm-package-license": "^3.0.1"
} }
}, },
"node_modules/read-pkg/node_modules/semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true,
"bin": {
"semver": "bin/semver"
}
},
"node_modules/read-pkg/node_modules/type-fest": { "node_modules/read-pkg/node_modules/type-fest": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz",
@@ -2667,17 +2674,11 @@
} }
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "7.3.8", "version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": { "bin": {
"semver": "bin/semver.js" "semver": "bin/semver"
},
"engines": {
"node": ">=10"
} }
}, },
"node_modules/semver-compare": { "node_modules/semver-compare": {
@@ -2685,22 +2686,6 @@
"resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz",
"integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=" "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w="
}, },
"node_modules/semver/node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/semver/node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/serialize-javascript": { "node_modules/serialize-javascript": {
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz",
@@ -3264,6 +3249,33 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/ts-loader/node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/ts-loader/node_modules/semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/ts-loader/node_modules/supports-color": { "node_modules/ts-loader/node_modules/supports-color": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@@ -3276,6 +3288,12 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/ts-loader/node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
},
"node_modules/tunnel": { "node_modules/tunnel": {
"version": "0.0.6", "version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
@@ -3959,9 +3977,14 @@
"integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA==" "integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA=="
}, },
"@types/semver": { "@types/semver": {
"version": "7.3.13", "version": "5.5.0",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", "integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ=="
},
"@types/semver-compare": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/semver-compare/-/semver-compare-1.0.1.tgz",
"integrity": "sha512-wx2LQVvKlEkhXp/HoKIZ/aSL+TvfJdKco8i0xJS3aR877mg4qBHzNT6+B5a61vewZHo79EdZavskGnRXEC2H6A==",
"dev": true "dev": true
}, },
"@types/uuid": { "@types/uuid": {
@@ -4289,11 +4312,6 @@
"uuid": "^3.0.1" "uuid": "^3.0.1"
}, },
"dependencies": { "dependencies": {
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
},
"uuid": { "uuid": {
"version": "3.4.0", "version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
@@ -4315,11 +4333,6 @@
"uuid": "^3.3.2" "uuid": "^3.3.2"
}, },
"dependencies": { "dependencies": {
"@types/semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ=="
},
"@types/uuid": { "@types/uuid": {
"version": "3.4.9", "version": "3.4.9",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.9.tgz", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.9.tgz",
@@ -4344,11 +4357,6 @@
"resolved": "https://registry.npmjs.org/mockery/-/mockery-1.7.0.tgz", "resolved": "https://registry.npmjs.org/mockery/-/mockery-1.7.0.tgz",
"integrity": "sha512-gUQA33ayi0tuAhr/rJNZPr7Q7uvlBt4gyJPbi0CDcAfIzIrDu1YgGMFgmAu3stJqBpK57m7+RxUbcS+pt59fKQ==" "integrity": "sha512-gUQA33ayi0tuAhr/rJNZPr7Q7uvlBt4gyJPbi0CDcAfIzIrDu1YgGMFgmAu3stJqBpK57m7+RxUbcS+pt59fKQ=="
}, },
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
},
"uuid": { "uuid": {
"version": "3.4.0", "version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
@@ -5506,6 +5514,32 @@
"resolve": "^1.20.0", "resolve": "^1.20.0",
"semver": "^7.3.4", "semver": "^7.3.4",
"validate-npm-package-license": "^3.0.1" "validate-npm-package-license": "^3.0.1"
},
"dependencies": {
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"requires": {
"yallist": "^4.0.0"
}
},
"semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
}
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
}
} }
}, },
"normalize-path": { "normalize-path": {
@@ -5781,12 +5815,6 @@
"validate-npm-package-license": "^3.0.1" "validate-npm-package-license": "^3.0.1"
} }
}, },
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
},
"type-fest": { "type-fest": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz",
@@ -5919,27 +5947,9 @@
} }
}, },
"semver": { "semver": {
"version": "7.3.8", "version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
"requires": {
"lru-cache": "^6.0.0"
},
"dependencies": {
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"requires": {
"yallist": "^4.0.0"
}
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}
}
}, },
"semver-compare": { "semver-compare": {
"version": "1.0.0", "version": "1.0.0",
@@ -6387,6 +6397,24 @@
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true "dev": true
}, },
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"requires": {
"yallist": "^4.0.0"
}
},
"semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
}
},
"supports-color": { "supports-color": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@@ -6395,6 +6423,12 @@
"requires": { "requires": {
"has-flag": "^4.0.0" "has-flag": "^4.0.0"
} }
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
} }
} }
}, },

View File

@@ -33,14 +33,13 @@
"azure-pipelines-task-lib": "^4.3.0", "azure-pipelines-task-lib": "^4.3.0",
"azure-pipelines-tool-lib": "^1.3.2", "azure-pipelines-tool-lib": "^1.3.2",
"inversify": "^6.0.1", "inversify": "^6.0.1",
"semver": "^7.3.8",
"typed-rest-client": "^1.8.9", "typed-rest-client": "^1.8.9",
"uuid": "^9.0.0" "uuid": "^9.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^18.15.0", "@types/node": "^18.15.0",
"@types/q": "^1.5.5", "@types/q": "^1.5.5",
"@types/semver": "^7.3.13", "@types/semver-compare": "^1.0.1",
"@types/uuid": "^9.0.1", "@types/uuid": "^9.0.1",
"minimist": "^1.2.8", "minimist": "^1.2.8",
"prettier": "^2.8.4", "prettier": "^2.8.4",

View File

@@ -24,7 +24,12 @@ class BuildAgent implements IBuildAgent {
return toolLib.findLocalTool(toolName, versionSpec, arch) return toolLib.findLocalTool(toolName, versionSpec, arch)
} }
public cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string> { public cacheDir(
sourceDir: string,
tool: string,
version: string,
arch?: string
): Promise<string> {
return toolLib.cacheDir(sourceDir, tool, version, arch) return toolLib.cacheDir(sourceDir, tool, version, arch)
} }

View File

@@ -12,7 +12,10 @@ import * as toolCache from '@actions/tool-cache'
import { injectable } from 'inversify' import { injectable } from 'inversify'
import { IBuildAgent, IExecResult } from '../../core/models' import { IBuildAgent, IExecResult } from '../../core/models'
import { IRequestOptions, IProxyConfiguration } from 'typed-rest-client/Interfaces' import {
IRequestOptions,
IProxyConfiguration
} from 'typed-rest-client/Interfaces'
@injectable() @injectable()
class BuildAgent implements IBuildAgent { class BuildAgent implements IBuildAgent {
@@ -55,7 +58,12 @@ class BuildAgent implements IBuildAgent {
return undefined return undefined
} }
let proxyURL = process.env.HTTP_PROXY || process.env.http_proxy || process.env.HTTPS_PROXY || process.env.https_proxy || null let proxyURL =
process.env.HTTP_PROXY ||
process.env.http_proxy ||
process.env.HTTPS_PROXY ||
process.env.https_proxy ||
null
if (proxyURL) { if (proxyURL) {
let url = new urlApi.URL(requestedUrl) let url = new urlApi.URL(requestedUrl)
@@ -70,7 +78,12 @@ class BuildAgent implements IBuildAgent {
return undefined return undefined
} }
public cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string> { public cacheDir(
sourceDir: string,
tool: string,
version: string,
arch?: string
): Promise<string> {
return toolCache.cacheDir(sourceDir, tool, version, arch) return toolCache.cacheDir(sourceDir, tool, version, arch)
} }

View File

@@ -19,7 +19,12 @@ class BuildAgent implements IBuildAgent {
return 'find' return 'find'
} }
public cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string> { public cacheDir(
sourceDir: string,
tool: string,
version: string,
arch?: string
): Promise<string> {
console.log('cacheDir') console.log('cacheDir')
return Promise.resolve('cacheDir') return Promise.resolve('cacheDir')
} }

View File

@@ -4,13 +4,16 @@ import * as path from 'path'
import * as http from 'typed-rest-client/HttpClient' import * as http from 'typed-rest-client/HttpClient'
import { inject, injectable } from 'inversify' import { inject, injectable } from 'inversify'
import { IBuildAgent, IExecResult, TYPES } from './models' import { TYPES, IExecResult, IBuildAgent, ISetupSettings } from './models'
import { IVersionManager } from './versionManager' import { IVersionManager } from './versionManager'
import { ISetupSettings } from '../tools/common/models'
export interface IDotnetTool { export interface IDotnetTool {
disableTelemetry(): void disableTelemetry(): void
toolInstall(toolName: string, setupSettings: ISetupSettings): Promise<string> toolInstall(
toolName: string,
checkLatest: boolean,
setupSettings: ISetupSettings
): Promise<string>
} }
@injectable() @injectable()
@@ -19,12 +22,20 @@ export class DotnetTool implements IDotnetTool {
protected versionManager: IVersionManager protected versionManager: IVersionManager
private httpClient: http.HttpClient private httpClient: http.HttpClient
private static readonly nugetRoot: string = 'https://azuresearch-usnc.nuget.org/' private static readonly nugetRoot: string =
'https://api-v2v3search-0.nuget.org/'
constructor(@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent, @inject(TYPES.IVersionManager) versionManager: IVersionManager) { constructor(
@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent,
@inject(TYPES.IVersionManager) versionManager: IVersionManager
) {
this.buildAgent = buildAgent this.buildAgent = buildAgent
this.versionManager = versionManager this.versionManager = versionManager
this.httpClient = new http.HttpClient('dotnet', undefined, this.buildAgent.proxyConfiguration(DotnetTool.nugetRoot)) this.httpClient = new http.HttpClient(
'dotnet',
undefined,
this.buildAgent.proxyConfiguration(DotnetTool.nugetRoot)
)
} }
public disableTelemetry(): void { public disableTelemetry(): void {
@@ -37,17 +48,20 @@ export class DotnetTool implements IDotnetTool {
return this.buildAgent.exec(cmd, args) return this.buildAgent.exec(cmd, args)
} }
public async toolInstall(toolName: string, setupSettings: ISetupSettings): Promise<string> { public async toolInstall(
toolName: string,
checkLatest: boolean,
setupSettings: ISetupSettings
): Promise<string> {
console.log('') console.log('')
console.log('--------------------------') console.log('--------------------------')
console.log(`Acquiring ${toolName} version spec: ${setupSettings.versionSpec}`) console.log(
`Installing ${toolName} version ` + setupSettings.versionSpec
)
console.log('--------------------------') console.log('--------------------------')
let version: string
let checkLatest = setupSettings.preferLatestVersion
if (this.versionManager.isExplicitVersion(setupSettings.versionSpec)) { if (this.versionManager.isExplicitVersion(setupSettings.versionSpec)) {
checkLatest = false // check latest doesn't make sense when explicit version checkLatest = false // check latest doesn't make sense when explicit version
version = setupSettings.versionSpec
} }
let toolPath: string let toolPath: string
@@ -59,7 +73,10 @@ export class DotnetTool implements IDotnetTool {
} }
if (!toolPath) { if (!toolPath) {
if (this.versionManager.isExplicitVersion(setupSettings.versionSpec)) { let version: string
if (
this.versionManager.isExplicitVersion(setupSettings.versionSpec)
) {
// //
// Explicit version was specified. No need to query for list of versions. // Explicit version was specified. No need to query for list of versions.
// //
@@ -71,9 +88,15 @@ export class DotnetTool implements IDotnetTool {
// If your tool doesn't offer a mechanism to query, // If your tool doesn't offer a mechanism to query,
// then it can only support exact version inputs. // then it can only support exact version inputs.
// //
version = await this.queryLatestMatch(toolName, setupSettings.versionSpec, setupSettings.includePrerelease) version = await this.queryLatestMatch(
toolName,
setupSettings.versionSpec,
setupSettings.includePrerelease
)
if (!version) { if (!version) {
throw new Error(`Unable to find ${toolName} version '${setupSettings.versionSpec}'.`) throw new Error(
`Unable to find ${toolName} version '${setupSettings.versionSpec}'.`
)
} }
// //
@@ -85,20 +108,24 @@ export class DotnetTool implements IDotnetTool {
// //
// Download, extract, cache // Download, extract, cache
// //
toolPath = await this.acquireTool(toolName, version, setupSettings.ignoreFailedSources) toolPath = await this.acquireTool(
toolName,
version,
setupSettings.ignoreFailedSources
)
} }
} }
console.log('--------------------------')
console.log(`${toolName} version: ${version} installed.`)
console.log('--------------------------')
// //
// Prepend the tools path. This prepends the PATH for the current process and // Prepend the tools path. This prepends the PATH for the current process and
// instructs the agent to prepend for each task that follows. // instructs the agent to prepend for each task that follows.
// //
this.buildAgent.debug(`toolPath: ${toolPath}`) this.buildAgent.debug(`toolPath: ${toolPath}`)
if (os.platform() !== 'win32' && !this.buildAgent.getVariable('DOTNET_ROOT')) { if (
os.platform() !== 'win32' &&
!this.buildAgent.getVariable('DOTNET_ROOT')
) {
let dotnetPath = await this.buildAgent.which('dotnet') let dotnetPath = await this.buildAgent.which('dotnet')
dotnetPath = fs.readlinkSync(dotnetPath) || dotnetPath dotnetPath = fs.readlinkSync(dotnetPath) || dotnetPath
const dotnetRoot = path.dirname(dotnetPath) const dotnetRoot = path.dirname(dotnetPath)
@@ -109,14 +136,22 @@ export class DotnetTool implements IDotnetTool {
return toolPath return toolPath
} }
private async queryLatestMatch(toolName: string, versionSpec: string, includePrerelease: boolean): Promise<string> { private async queryLatestMatch(
toolName: string,
versionSpec: string,
includePrerelease: boolean
): Promise<string> {
this.buildAgent.debug( this.buildAgent.debug(
`querying tool versions for ${toolName}${versionSpec ? `@${versionSpec}` : ''} ${includePrerelease ? 'including pre-releases' : ''}` `querying tool versions for ${toolName}${
versionSpec ? `@${versionSpec}` : ''
} ${includePrerelease ? 'including pre-releases' : ''}`
) )
const toolNameParam = encodeURIComponent(toolName.toLowerCase()) const downloadPath = `${
const prereleaseParam = includePrerelease ? 'true' : 'false' DotnetTool.nugetRoot
const downloadPath = `${DotnetTool.nugetRoot}query?q=${toolNameParam}&prerelease=${prereleaseParam}&semVerLevel=2.0.0&take=1` }query?q=${encodeURIComponent(toolName.toLowerCase())}&prerelease=${
includePrerelease ? 'true' : 'false'
}&semVerLevel=2.0.0`
const res = await this.httpClient.get(downloadPath) const res = await this.httpClient.get(downloadPath)
@@ -127,19 +162,23 @@ export class DotnetTool implements IDotnetTool {
const body: string = await res.readBody() const body: string = await res.readBody()
const data = JSON.parse(body).data const data = JSON.parse(body).data
const versions = (data[0].versions as { version: string }[]).map(x => x.version) const versions = (data[0].versions as { version: string }[]).map(
x => x.version
)
if (!versions || !versions.length) { if (!versions || !versions.length) {
return null return null
} }
this.buildAgent.debug(`got versions: ${versions.join(', ')}`) this.buildAgent.debug(`got versions: ${versions.join(', ')}`)
return this.versionManager.evaluateVersions(versions, versionSpec, { return this.versionManager.evaluateVersions(versions, versionSpec)
includePrerelease
})
} }
private async acquireTool(toolName: string, version: string, ignoreFailedSources: boolean): Promise<string> { private async acquireTool(
toolName: string,
version: string,
ignoreFailedSources: boolean
): Promise<string> {
const tempDirectory = await this.buildAgent.createTempDir() const tempDirectory = await this.buildAgent.createTempDir()
let args = ['tool', 'install', toolName, '--tool-path', tempDirectory] let args = ['tool', 'install', toolName, '--tool-path', tempDirectory]

View File

@@ -5,9 +5,19 @@ export const TYPES = {
IDotnetTool: Symbol.for('DotnetTool'), IDotnetTool: Symbol.for('DotnetTool'),
IGitVersionTool: Symbol.for('GitVersionTool'), IGitVersionTool: Symbol.for('GitVersionTool'),
IGitReleaseManagerTool: Symbol.for('GitReleaseManagerTool'), IGitReleaseManagerTool: Symbol.for('GitReleaseManagerTool'),
IVersionManager: Symbol.for('VersionManager'), IVersionManager: Symbol.for('VersionManager')
IGitVersionSettingsProvider: Symbol.for('GitVersionSettingsProvider'), }
IGitReleaseManagerSettingsProvider: Symbol.for('GitReleaseManagerSettingsProvider')
export enum SetupFields {
includePrerelease = 'includePrerelease',
versionSpec = 'versionSpec',
ignoreFailedSources = 'ignoreFailedSources'
}
export interface ISetupSettings {
[SetupFields.versionSpec]: string
[SetupFields.includePrerelease]: boolean
[SetupFields.ignoreFailedSources]: boolean
} }
export interface IExecResult { export interface IExecResult {
@@ -16,11 +26,17 @@ export interface IExecResult {
code: number code: number
error: Error error: Error
} }
export interface IBuildAgent { export interface IBuildAgent {
agentName: string agentName: string
proxyConfiguration(url: string): IRequestOptions proxyConfiguration(url: string): IRequestOptions
find(toolName: string, versionSpec: string, arch?: string): string find(toolName: string, versionSpec: string, arch?: string): string
cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string> cacheDir(
sourceDir: string,
tool: string,
version: string,
arch?: string
): Promise<string>
createTempDir(): Promise<string> createTempDir(): Promise<string>
debug(message: string): void debug(message: string): void
setFailed(message: string, done?: boolean): void setFailed(message: string, done?: boolean): void

19
src/core/settings.ts Normal file
View File

@@ -0,0 +1,19 @@
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
)
const ignoreFailedSources = buildAgent.getBooleanInput(
SetupFields.ignoreFailedSources
)
return {
versionSpec,
includePrerelease,
ignoreFailedSources
}
}
}

View File

@@ -1,3 +1,4 @@
import cmp from 'semver-compare'
import * as semver from 'semver' import * as semver from 'semver'
import { injectable, inject } from 'inversify' import { injectable, inject } from 'inversify'
@@ -5,7 +6,7 @@ import { IBuildAgent, TYPES } from './models'
export interface IVersionManager { export interface IVersionManager {
isExplicitVersion(versionSpec: string): boolean isExplicitVersion(versionSpec: string): boolean
evaluateVersions(versions: string[], versionSpec: string, optionsOrLoose?: boolean | semver.RangeOptions): string evaluateVersions(versions: string[], versionSpec: string): string
cleanVersion(version: string): string cleanVersion(version: string): string
} }
@@ -26,13 +27,13 @@ export class VersionManager implements IVersionManager {
return valid return valid
} }
public evaluateVersions(versions: string[], versionSpec: string, optionsOrLoose?: boolean | semver.RangeOptions): string { public evaluateVersions(versions: string[], versionSpec: string): string {
let version: string let version: string
this.buildAgent.debug('evaluating ' + versions.length + ' versions') this.buildAgent.debug('evaluating ' + versions.length + ' versions')
versions = semver.sort(versions) versions = versions.sort(cmp)
for (let i = versions.length - 1; i >= 0; i--) { for (let i = versions.length - 1; i >= 0; i--) {
const potential: string = versions[i] const potential: string = versions[i]
const satisfied: boolean = semver.satisfies(potential, versionSpec, optionsOrLoose) const satisfied: boolean = semver.satisfies(potential, versionSpec)
if (satisfied) { if (satisfied) {
version = potential version = potential
break break

View File

@@ -1,4 +1,4 @@
import 'reflect-metadata' import 'reflect-metadata'
import { addAsset } from './main' import { addAsset } from './main'
await addAsset() addAsset()

View File

@@ -1,4 +1,4 @@
import 'reflect-metadata' import 'reflect-metadata'
import { close } from './main' import { close } from './main'
await close() close()

View File

@@ -1,4 +1,4 @@
import 'reflect-metadata' import 'reflect-metadata'
import { create } from './main' import { create } from './main'
await create() create()

View File

@@ -1,4 +1,4 @@
import 'reflect-metadata' import 'reflect-metadata'
import { discard } from './main' import { discard } from './main'
await discard() discard()

View File

@@ -1,26 +1,34 @@
import { IBuildAgent, TYPES } from '../../core/models' import { IBuildAgent, TYPES } from '../../core/models'
import { IGitReleaseManagerTool, GitReleaseManagerTool } from '../../tools/gitreleasemanager/tool' import {
import { IGitReleaseManagerSettingsProvider } from '../../tools/gitreleasemanager/models' IGitReleaseManagerTool,
import { GitReleaseManagerSettingsProvider } from '../../tools/gitreleasemanager/settings' GitReleaseManagerTool
} from '../../tools/gitreleasemanager/tool'
import { Settings as CommonSettings } from '../../core/settings'
import { Settings } from '../../tools/gitreleasemanager/settings'
import container from '../../core/ioc' import container from '../../core/ioc'
container.bind<IGitReleaseManagerTool>(TYPES.IGitReleaseManagerTool).to(GitReleaseManagerTool) container
container.bind<IGitReleaseManagerSettingsProvider>(TYPES.IGitReleaseManagerSettingsProvider).to(GitReleaseManagerSettingsProvider) .bind<IGitReleaseManagerTool>(TYPES.IGitReleaseManagerTool)
.to(GitReleaseManagerTool)
const gitReleaseManagerTool = container.get<IGitReleaseManagerTool>(
TYPES.IGitReleaseManagerTool
)
const buildAgent = container.get<IBuildAgent>(TYPES.IBuildAgent) const buildAgent = container.get<IBuildAgent>(TYPES.IBuildAgent)
const gitReleaseManagerTool = container.get<IGitReleaseManagerTool>(TYPES.IGitReleaseManagerTool)
const settingsProvider = container.get<IGitReleaseManagerSettingsProvider>(TYPES.IGitReleaseManagerSettingsProvider)
export async function setup() { export async function setup() {
try { try {
gitReleaseManagerTool.disableTelemetry() gitReleaseManagerTool.disableTelemetry()
const settings = settingsProvider.getSetupSettings() const settings = CommonSettings.getSetupSettings(buildAgent)
await gitReleaseManagerTool.install(settings) await gitReleaseManagerTool.install(settings)
buildAgent.setSucceeded('GitVersionManager installed successfully', true) buildAgent.setSucceeded(
'GitVersionManager installed successfully',
true
)
} catch (error) { } catch (error) {
buildAgent.setFailed(error.message, true) buildAgent.setFailed(error.message, true)
} }
@@ -30,11 +38,14 @@ export async function create() {
try { try {
gitReleaseManagerTool.disableTelemetry() gitReleaseManagerTool.disableTelemetry()
const settings = settingsProvider.getCreateSettings() const settings = Settings.getCreateSettings(buildAgent)
await gitReleaseManagerTool.create(settings) await gitReleaseManagerTool.create(settings)
buildAgent.setSucceeded('GitVersionManager created release successfully', true) buildAgent.setSucceeded(
'GitVersionManager created release successfully',
true
)
} catch (error) { } catch (error) {
buildAgent.setFailed(error.message, true) buildAgent.setFailed(error.message, true)
} }
@@ -44,11 +55,14 @@ export async function discard() {
try { try {
gitReleaseManagerTool.disableTelemetry() gitReleaseManagerTool.disableTelemetry()
const settings = settingsProvider.getDiscardSettings() const settings = Settings.getDiscardSettings(buildAgent)
await gitReleaseManagerTool.discard(settings) await gitReleaseManagerTool.discard(settings)
buildAgent.setSucceeded('GitVersionManager discarded release successfully', true) buildAgent.setSucceeded(
'GitVersionManager discarded release successfully',
true
)
} catch (error) { } catch (error) {
buildAgent.setFailed(error.message, true) buildAgent.setFailed(error.message, true)
} }
@@ -58,11 +72,14 @@ export async function close() {
try { try {
gitReleaseManagerTool.disableTelemetry() gitReleaseManagerTool.disableTelemetry()
const settings = settingsProvider.getCloseSettings() const settings = Settings.getCloseSettings(buildAgent)
await gitReleaseManagerTool.close(settings) await gitReleaseManagerTool.close(settings)
buildAgent.setSucceeded('GitVersionManager closed release successfully', true) buildAgent.setSucceeded(
'GitVersionManager closed release successfully',
true
)
} catch (error) { } catch (error) {
buildAgent.setFailed(error.message, true) buildAgent.setFailed(error.message, true)
} }
@@ -72,11 +89,14 @@ export async function open() {
try { try {
gitReleaseManagerTool.disableTelemetry() gitReleaseManagerTool.disableTelemetry()
const settings = settingsProvider.getOpenSettings() const settings = Settings.getOpenSettings(buildAgent)
await gitReleaseManagerTool.open(settings) await gitReleaseManagerTool.open(settings)
buildAgent.setSucceeded('GitVersionManager opened release successfully', true) buildAgent.setSucceeded(
'GitVersionManager opened release successfully',
true
)
} catch (error) { } catch (error) {
buildAgent.setFailed(error.message, true) buildAgent.setFailed(error.message, true)
} }
@@ -86,11 +106,14 @@ export async function publish() {
try { try {
gitReleaseManagerTool.disableTelemetry() gitReleaseManagerTool.disableTelemetry()
const settings = settingsProvider.getPublishSettings() const settings = Settings.getPublishSettings(buildAgent)
await gitReleaseManagerTool.publish(settings) await gitReleaseManagerTool.publish(settings)
buildAgent.setSucceeded('GitVersionManager published release successfully', true) buildAgent.setSucceeded(
'GitVersionManager published release successfully',
true
)
} catch (error) { } catch (error) {
buildAgent.setFailed(error.message, true) buildAgent.setFailed(error.message, true)
} }
@@ -100,11 +123,14 @@ export async function addAsset() {
try { try {
gitReleaseManagerTool.disableTelemetry() gitReleaseManagerTool.disableTelemetry()
const settings = settingsProvider.getAddAssetSettings() const settings = Settings.getAddAssetSettings(buildAgent)
await gitReleaseManagerTool.addAsset(settings) await gitReleaseManagerTool.addAsset(settings)
buildAgent.setSucceeded('GitVersionManager added assets to release successfully', true) buildAgent.setSucceeded(
'GitVersionManager added assets to release successfully',
true
)
} catch (error) { } catch (error) {
buildAgent.setFailed(error.message, true) buildAgent.setFailed(error.message, true)
} }

View File

@@ -1,4 +1,4 @@
import 'reflect-metadata' import 'reflect-metadata'
import { open } from './main' import { open } from './main'
await open() open()

View File

@@ -1,4 +1,4 @@
import 'reflect-metadata' import 'reflect-metadata'
import { publish } from './main' import { publish } from './main'
await publish() publish()

View File

@@ -1,4 +1,4 @@
import 'reflect-metadata' import 'reflect-metadata'
import { setup } from './main' import { setup } from './main'
await setup() setup()

View File

@@ -1,4 +1,4 @@
import 'reflect-metadata' import 'reflect-metadata'
import { run } from './main' import { run } from './main'
await run() run()

View File

@@ -1,23 +1,24 @@
import { IBuildAgent, TYPES } from '../../core/models' import { IBuildAgent, TYPES } from '../../core/models'
import { Settings as CommonSettings } from '../../core/settings'
import { Settings } from '../../tools/gitversion/settings'
import { IGitVersionTool, GitVersionTool } from '../../tools/gitversion/tool' import { IGitVersionTool, GitVersionTool } from '../../tools/gitversion/tool'
import { GitVersionSettings, GitVersionOutput, IGitVersionSettingsProvider } from '../../tools/gitversion/models' import {
import { GitVersionSettingsProvider } from '../../tools/gitversion/settings' GitVersionSettings,
GitVersionOutput
} from '../../tools/gitversion/models'
import container from '../../core/ioc' import container from '../../core/ioc'
container.bind<IGitVersionTool>(TYPES.IGitVersionTool).to(GitVersionTool) container.bind<IGitVersionTool>(TYPES.IGitVersionTool).to(GitVersionTool)
container.bind<IGitVersionSettingsProvider>(TYPES.IGitVersionSettingsProvider).to(GitVersionSettingsProvider)
const buildAgent = container.get<IBuildAgent>(TYPES.IBuildAgent)
const gitVersionTool = container.get<IGitVersionTool>(TYPES.IGitVersionTool) const gitVersionTool = container.get<IGitVersionTool>(TYPES.IGitVersionTool)
const settingsProvider = container.get<IGitVersionSettingsProvider>(TYPES.IGitVersionSettingsProvider) const buildAgent = container.get<IBuildAgent>(TYPES.IBuildAgent)
export async function setup() { export async function setup() {
try { try {
gitVersionTool.disableTelemetry() gitVersionTool.disableTelemetry()
console.log(`Agent: '${buildAgent.agentName}'`)
const settings = settingsProvider.getSetupSettings() const settings = CommonSettings.getSetupSettings(buildAgent)
await gitVersionTool.install(settings) await gitVersionTool.install(settings)
@@ -30,24 +31,23 @@ export async function setup() {
export async function run() { export async function run() {
try { try {
gitVersionTool.disableTelemetry() gitVersionTool.disableTelemetry()
console.log(`Agent: '${buildAgent.agentName}'`)
const settings: GitVersionSettings = settingsProvider.getGitVersionSettings() const settings: GitVersionSettings = Settings.getGitVersionSettings(
buildAgent
)
const result = await gitVersionTool.run(settings) const result = await gitVersionTool.run(settings)
const { stdout } = result
const jsonOutput = stdout.substring(
stdout.lastIndexOf('{'),
stdout.lastIndexOf('}') + 1
)
const gitversion = JSON.parse(jsonOutput) as GitVersionOutput
gitVersionTool.writeGitVersionToAgent(gitversion)
if (result.code === 0) { if (result.code === 0) {
buildAgent.setSucceeded('GitVersion executed successfully', true) buildAgent.setSucceeded('GitVersion executed successfully', true)
const { stdout } = result
if (stdout.lastIndexOf('{') === -1 || stdout.lastIndexOf('}') === -1) {
buildAgent.setFailed('GitVersion output is not valid JSON', true)
} else {
const jsonOutput = stdout.substring(stdout.lastIndexOf('{'), stdout.lastIndexOf('}') + 1)
const gitversion = JSON.parse(jsonOutput) as GitVersionOutput
gitVersionTool.writeGitVersionToAgent(gitversion)
}
} else { } else {
buildAgent.setFailed(result.error.message, true) buildAgent.setFailed(result.error.message, true)
} }

View File

@@ -1,4 +1,4 @@
import 'reflect-metadata' import 'reflect-metadata'
import { setup } from './main' import { setup } from './main'
await setup() setup()

View File

@@ -1,17 +0,0 @@
export enum SetupFields {
includePrerelease = 'includePrerelease',
versionSpec = 'versionSpec',
ignoreFailedSources = 'ignoreFailedSources',
preferLatestVersion = 'preferLatestVersion'
}
export interface ISetupSettings {
[SetupFields.versionSpec]: string
[SetupFields.includePrerelease]: boolean
[SetupFields.ignoreFailedSources]: boolean
[SetupFields.preferLatestVersion]: boolean
}
export interface ISettingsProvider {
getSetupSettings(): ISetupSettings
}

View File

@@ -1,22 +0,0 @@
import { injectable } from 'inversify'
import { ISettingsProvider, ISetupSettings, SetupFields } from './models'
import { IBuildAgent } from '../../core/models'
@injectable()
export class SettingsProvider implements ISettingsProvider {
constructor(protected buildAgent: IBuildAgent) {}
public getSetupSettings(): ISetupSettings {
const versionSpec = this.buildAgent.getInput(SetupFields.versionSpec)
const includePrerelease = this.buildAgent.getBooleanInput(SetupFields.includePrerelease)
const ignoreFailedSources = this.buildAgent.getBooleanInput(SetupFields.ignoreFailedSources)
const preferLatestVersion = this.buildAgent.getBooleanInput(SetupFields.preferLatestVersion)
return {
versionSpec,
includePrerelease,
ignoreFailedSources,
preferLatestVersion
}
}
}

View File

@@ -1,5 +1,3 @@
import { ISettingsProvider } from '../common/models'
export enum CommonFields { export enum CommonFields {
repository = 'repository', repository = 'repository',
owner = 'owner', owner = 'owner',
@@ -37,22 +35,6 @@ export enum AddAssetFields {
assets = 'assets' assets = 'assets'
} }
export interface IGitReleaseManagerSettingsProvider extends ISettingsProvider {
getCreateSettings(): GitReleaseManagerCreateSettings
getDiscardSettings(): GitReleaseManagerDiscardSettings
getCloseSettings(): GitReleaseManagerCloseSettings
getOpenSettings(): GitReleaseManagerOpenSettings
getPublishSettings(): GitReleaseManagerPublishSettings
getAddAssetSettings(): GitReleaseManagerAddAssetSettings
getCommonSettings(): GitReleaseManagerSettings
}
export interface GitReleaseManagerSettings { export interface GitReleaseManagerSettings {
[CommonFields.repository]: string [CommonFields.repository]: string
[CommonFields.owner]: string [CommonFields.owner]: string
@@ -60,7 +42,8 @@ export interface GitReleaseManagerSettings {
[CommonFields.targetDirectory]: string [CommonFields.targetDirectory]: string
} }
export interface GitReleaseManagerCreateSettings extends GitReleaseManagerSettings { export interface GitReleaseManagerCreateSettings
extends GitReleaseManagerSettings {
[CreateFields.milestone]: string [CreateFields.milestone]: string
[CreateFields.name]: string [CreateFields.name]: string
[CreateFields.inputFileName]: string [CreateFields.inputFileName]: string
@@ -69,23 +52,28 @@ export interface GitReleaseManagerCreateSettings extends GitReleaseManagerSettin
[CreateFields.assets]?: string[] [CreateFields.assets]?: string[]
} }
export interface GitReleaseManagerDiscardSettings extends GitReleaseManagerSettings { export interface GitReleaseManagerDiscardSettings
extends GitReleaseManagerSettings {
[DiscardFields.milestone]: string [DiscardFields.milestone]: string
} }
export interface GitReleaseManagerCloseSettings extends GitReleaseManagerSettings { export interface GitReleaseManagerCloseSettings
extends GitReleaseManagerSettings {
[CloseFields.milestone]: string [CloseFields.milestone]: string
} }
export interface GitReleaseManagerOpenSettings extends GitReleaseManagerSettings { export interface GitReleaseManagerOpenSettings
extends GitReleaseManagerSettings {
[OpenFields.milestone]: string [OpenFields.milestone]: string
} }
export interface GitReleaseManagerPublishSettings extends GitReleaseManagerSettings { export interface GitReleaseManagerPublishSettings
extends GitReleaseManagerSettings {
[PublishFields.tagName]: string [PublishFields.tagName]: string
} }
export interface GitReleaseManagerAddAssetSettings extends GitReleaseManagerSettings { export interface GitReleaseManagerAddAssetSettings
extends GitReleaseManagerSettings {
[AddAssetFields.tagName]: string [AddAssetFields.tagName]: string
[AddAssetFields.assets]: string[] [AddAssetFields.assets]: string[]
} }

View File

@@ -1,39 +1,35 @@
import { IBuildAgent, TYPES } from '../../core/models' import { IBuildAgent } from '../../core/models'
import { import {
AddAssetFields, GitReleaseManagerSettings,
CloseFields,
CommonFields, CommonFields,
CreateFields, CreateFields,
DiscardFields, DiscardFields,
GitReleaseManagerAddAssetSettings, CloseFields,
GitReleaseManagerCloseSettings, OpenFields,
PublishFields,
AddAssetFields,
GitReleaseManagerCreateSettings, GitReleaseManagerCreateSettings,
GitReleaseManagerDiscardSettings, GitReleaseManagerDiscardSettings,
GitReleaseManagerCloseSettings,
GitReleaseManagerOpenSettings, GitReleaseManagerOpenSettings,
GitReleaseManagerPublishSettings, GitReleaseManagerPublishSettings,
GitReleaseManagerSettings, GitReleaseManagerAddAssetSettings
IGitReleaseManagerSettingsProvider,
OpenFields,
PublishFields
} from './models' } from './models'
import { SettingsProvider } from '../common/settings'
import { inject, injectable } from 'inversify'
@injectable() export class Settings {
export class GitReleaseManagerSettingsProvider extends SettingsProvider implements IGitReleaseManagerSettingsProvider { public static getCreateSettings(
constructor(@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent) { buildAgent: IBuildAgent
super(buildAgent) ): GitReleaseManagerCreateSettings {
} const milestone = buildAgent.getInput(CreateFields.milestone)
const name = buildAgent.getInput(CreateFields.name)
const inputFileName = buildAgent.getInput(CreateFields.inputFileName)
const isPreRelease = buildAgent.getBooleanInput(
CreateFields.isPreRelease
)
const commit = buildAgent.getInput(CreateFields.commit)
const assets = buildAgent.getListInput(CreateFields.assets)
getCreateSettings(): GitReleaseManagerCreateSettings { const commonSettings = Settings.getCommonSettings(buildAgent)
const milestone = this.buildAgent.getInput(CreateFields.milestone)
const name = this.buildAgent.getInput(CreateFields.name)
const inputFileName = this.buildAgent.getInput(CreateFields.inputFileName)
const isPreRelease = this.buildAgent.getBooleanInput(CreateFields.isPreRelease)
const commit = this.buildAgent.getInput(CreateFields.commit)
const assets = this.buildAgent.getListInput(CreateFields.assets)
const commonSettings = this.getCommonSettings()
return { return {
...commonSettings, ...commonSettings,
milestone, milestone,
@@ -45,51 +41,61 @@ export class GitReleaseManagerSettingsProvider extends SettingsProvider implemen
} }
} }
getDiscardSettings(): GitReleaseManagerDiscardSettings { public static getDiscardSettings(
const milestone = this.buildAgent.getInput(DiscardFields.milestone) buildAgent: IBuildAgent
): GitReleaseManagerDiscardSettings {
const milestone = buildAgent.getInput(DiscardFields.milestone)
const commonSettings = this.getCommonSettings() const commonSettings = Settings.getCommonSettings(buildAgent)
return { return {
...commonSettings, ...commonSettings,
milestone milestone
} }
} }
getCloseSettings(): GitReleaseManagerCloseSettings { public static getCloseSettings(
const milestone = this.buildAgent.getInput(CloseFields.milestone) buildAgent: IBuildAgent
): GitReleaseManagerCloseSettings {
const milestone = buildAgent.getInput(CloseFields.milestone)
const commonSettings = this.getCommonSettings() const commonSettings = Settings.getCommonSettings(buildAgent)
return { return {
...commonSettings, ...commonSettings,
milestone milestone
} }
} }
getOpenSettings(): GitReleaseManagerOpenSettings { public static getOpenSettings(
const milestone = this.buildAgent.getInput(OpenFields.milestone) buildAgent: IBuildAgent
): GitReleaseManagerOpenSettings {
const milestone = buildAgent.getInput(OpenFields.milestone)
const commonSettings = this.getCommonSettings() const commonSettings = Settings.getCommonSettings(buildAgent)
return { return {
...commonSettings, ...commonSettings,
milestone milestone
} }
} }
getPublishSettings(): GitReleaseManagerPublishSettings { public static getPublishSettings(
const tagName = this.buildAgent.getInput(PublishFields.tagName) buildAgent: IBuildAgent
): GitReleaseManagerPublishSettings {
const tagName = buildAgent.getInput(PublishFields.tagName)
const commonSettings = this.getCommonSettings() const commonSettings = Settings.getCommonSettings(buildAgent)
return { return {
...commonSettings, ...commonSettings,
tagName tagName
} }
} }
getAddAssetSettings(): GitReleaseManagerAddAssetSettings { public static getAddAssetSettings(
const tagName = this.buildAgent.getInput(AddAssetFields.tagName) buildAgent: IBuildAgent
const assets = this.buildAgent.getListInput(AddAssetFields.assets) ): GitReleaseManagerAddAssetSettings {
const tagName = buildAgent.getInput(AddAssetFields.tagName)
const assets = buildAgent.getListInput(AddAssetFields.assets)
const commonSettings = this.getCommonSettings() const commonSettings = Settings.getCommonSettings(buildAgent)
return { return {
...commonSettings, ...commonSettings,
tagName, tagName,
@@ -97,11 +103,15 @@ export class GitReleaseManagerSettingsProvider extends SettingsProvider implemen
} }
} }
getCommonSettings(): GitReleaseManagerSettings { private static getCommonSettings(
const owner = this.buildAgent.getInput(CommonFields.owner, true) buildAgent: IBuildAgent
const repository = this.buildAgent.getInput(CommonFields.repository, true) ): GitReleaseManagerSettings {
const token = this.buildAgent.getInput(CommonFields.token, true) const owner = buildAgent.getInput(CommonFields.owner, true)
const targetDirectory = this.buildAgent.getInput(CommonFields.targetDirectory) const repository = buildAgent.getInput(CommonFields.repository, true)
const token = buildAgent.getInput(CommonFields.token, true)
const targetDirectory = buildAgent.getInput(
CommonFields.targetDirectory
)
return { return {
owner, owner,

View File

@@ -1,20 +1,19 @@
import * as path from 'path' import path = require('path')
import { IBuildAgent, IExecResult, TYPES } from '../../core/models' import { TYPES, IBuildAgent, IExecResult, ISetupSettings } from '../../core/models'
import { inject, injectable } from 'inversify' import { injectable, inject } from 'inversify'
import { DotnetTool, IDotnetTool } from '../../core/dotnet-tool' import { DotnetTool, IDotnetTool } from '../../core/dotnet-tool'
import { IVersionManager } from '../../core/versionManager' import { IVersionManager } from '../../core/versionManager'
import { import {
GitReleaseManagerAddAssetSettings, GitReleaseManagerSettings,
GitReleaseManagerCloseSettings,
GitReleaseManagerCreateSettings, GitReleaseManagerCreateSettings,
GitReleaseManagerDiscardSettings, GitReleaseManagerDiscardSettings,
GitReleaseManagerCloseSettings,
GitReleaseManagerOpenSettings, GitReleaseManagerOpenSettings,
GitReleaseManagerPublishSettings, GitReleaseManagerPublishSettings,
GitReleaseManagerSettings GitReleaseManagerAddAssetSettings
} from './models' } from './models'
import { ISetupSettings } from '../common/models'
export interface IGitReleaseManagerTool extends IDotnetTool { export interface IGitReleaseManagerTool extends IDotnetTool {
install(setupSettings: ISetupSettings): Promise<void> install(setupSettings: ISetupSettings): Promise<void>
@@ -27,28 +26,43 @@ export interface IGitReleaseManagerTool extends IDotnetTool {
} }
@injectable() @injectable()
export class GitReleaseManagerTool extends DotnetTool implements IGitReleaseManagerTool { export class GitReleaseManagerTool
constructor(@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent, @inject(TYPES.IVersionManager) versionManager: IVersionManager) { extends DotnetTool
implements IGitReleaseManagerTool {
constructor(
@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent,
@inject(TYPES.IVersionManager) versionManager: IVersionManager
) {
super(buildAgent, versionManager) super(buildAgent, versionManager)
} }
public async install(setupSettings: ISetupSettings): Promise<void> { public async install(setupSettings: ISetupSettings): Promise<void> {
await this.toolInstall('GitReleaseManager.Tool', setupSettings) await this.toolInstall(
'GitReleaseManager.Tool',
false,
setupSettings
)
} }
public create(settings: GitReleaseManagerCreateSettings): Promise<IExecResult> { public create(
settings: GitReleaseManagerCreateSettings
): Promise<IExecResult> {
const args = this.getCreateArguments(settings) const args = this.getCreateArguments(settings)
return this.execute('dotnet-gitreleasemanager', args) return this.execute('dotnet-gitreleasemanager', args)
} }
public discard(settings: GitReleaseManagerDiscardSettings): Promise<IExecResult> { public discard(
settings: GitReleaseManagerDiscardSettings
): Promise<IExecResult> {
const args = this.getDiscardArguments(settings) const args = this.getDiscardArguments(settings)
return this.execute('dotnet-gitreleasemanager', args) return this.execute('dotnet-gitreleasemanager', args)
} }
public close(settings: GitReleaseManagerCloseSettings): Promise<IExecResult> { public close(
settings: GitReleaseManagerCloseSettings
): Promise<IExecResult> {
const args = this.getCloseArguments(settings) const args = this.getCloseArguments(settings)
return this.execute('dotnet-gitreleasemanager', args) return this.execute('dotnet-gitreleasemanager', args)
@@ -60,13 +74,17 @@ export class GitReleaseManagerTool extends DotnetTool implements IGitReleaseMana
return this.execute('dotnet-gitreleasemanager', args) return this.execute('dotnet-gitreleasemanager', args)
} }
public publish(settings: GitReleaseManagerPublishSettings): Promise<IExecResult> { public publish(
settings: GitReleaseManagerPublishSettings
): Promise<IExecResult> {
const args = this.getPublishArguments(settings) const args = this.getPublishArguments(settings)
return this.execute('dotnet-gitreleasemanager', args) return this.execute('dotnet-gitreleasemanager', args)
} }
public addAsset(settings: GitReleaseManagerAddAssetSettings): Promise<IExecResult> { public addAsset(
settings: GitReleaseManagerAddAssetSettings
): Promise<IExecResult> {
const args = this.getAddAssetArguments(settings) const args = this.getAddAssetArguments(settings)
return this.execute('dotnet-gitreleasemanager', args) return this.execute('dotnet-gitreleasemanager', args)
@@ -86,7 +104,9 @@ export class GitReleaseManagerTool extends DotnetTool implements IGitReleaseMana
return args return args
} }
private getCreateArguments(settings: GitReleaseManagerCreateSettings): string[] { private getCreateArguments(
settings: GitReleaseManagerCreateSettings
): string[] {
const args: string[] = ['create', ...this.getCommonArguments(settings)] const args: string[] = ['create', ...this.getCommonArguments(settings)]
if (settings.milestone) { if (settings.milestone) {
@@ -103,7 +123,10 @@ export class GitReleaseManagerTool extends DotnetTool implements IGitReleaseMana
if (this.buildAgent.fileExists(settings.inputFileName)) { if (this.buildAgent.fileExists(settings.inputFileName)) {
args.push('--inputFilePath', settings.inputFileName) args.push('--inputFilePath', settings.inputFileName)
} else { } else {
throw new Error('GitReleaseManager inputFilePath not found at ' + settings.inputFileName) throw new Error(
'GitReleaseManager inputFilePath not found at ' +
settings.inputFileName
)
} }
} }
if (settings.isPreRelease) { if (settings.isPreRelease) {
@@ -120,7 +143,9 @@ export class GitReleaseManagerTool extends DotnetTool implements IGitReleaseMana
return args return args
} }
private getDiscardArguments(settings: GitReleaseManagerDiscardSettings): string[] { private getDiscardArguments(
settings: GitReleaseManagerDiscardSettings
): string[] {
const args: string[] = ['discard', ...this.getCommonArguments(settings)] const args: string[] = ['discard', ...this.getCommonArguments(settings)]
if (settings.milestone) { if (settings.milestone) {
@@ -130,7 +155,9 @@ export class GitReleaseManagerTool extends DotnetTool implements IGitReleaseMana
return args return args
} }
private getCloseArguments(settings: GitReleaseManagerCloseSettings): string[] { private getCloseArguments(
settings: GitReleaseManagerCloseSettings
): string[] {
const args: string[] = ['close', ...this.getCommonArguments(settings)] const args: string[] = ['close', ...this.getCommonArguments(settings)]
if (settings.milestone) { if (settings.milestone) {
@@ -140,7 +167,9 @@ export class GitReleaseManagerTool extends DotnetTool implements IGitReleaseMana
return args return args
} }
private getOpenArguments(settings: GitReleaseManagerOpenSettings): string[] { private getOpenArguments(
settings: GitReleaseManagerOpenSettings
): string[] {
const args: string[] = ['open', ...this.getCommonArguments(settings)] const args: string[] = ['open', ...this.getCommonArguments(settings)]
if (settings.milestone) { if (settings.milestone) {
@@ -150,7 +179,9 @@ export class GitReleaseManagerTool extends DotnetTool implements IGitReleaseMana
return args return args
} }
private getPublishArguments(settings: GitReleaseManagerPublishSettings): string[] { private getPublishArguments(
settings: GitReleaseManagerPublishSettings
): string[] {
const args: string[] = ['publish', ...this.getCommonArguments(settings)] const args: string[] = ['publish', ...this.getCommonArguments(settings)]
if (settings.tagName) { if (settings.tagName) {
@@ -160,8 +191,13 @@ export class GitReleaseManagerTool extends DotnetTool implements IGitReleaseMana
return args return args
} }
private getAddAssetArguments(settings: GitReleaseManagerAddAssetSettings): string[] { private getAddAssetArguments(
const args: string[] = ['addasset', ...this.getCommonArguments(settings)] settings: GitReleaseManagerAddAssetSettings
): string[] {
const args: string[] = [
'addasset',
...this.getCommonArguments(settings)
]
if (settings.tagName) { if (settings.tagName) {
args.push('--tagName', settings.tagName) args.push('--tagName', settings.tagName)

View File

@@ -1,5 +1,3 @@
import { ISettingsProvider } from '../common/models'
export enum ExecuteFields { export enum ExecuteFields {
targetPath = 'targetPath', targetPath = 'targetPath',
useConfigFile = 'useConfigFile', useConfigFile = 'useConfigFile',
@@ -20,10 +18,6 @@ export interface GitVersionSettings {
[ExecuteFields.srcDir]: string [ExecuteFields.srcDir]: string
} }
export interface IGitVersionSettingsProvider extends ISettingsProvider {
getGitVersionSettings(): GitVersionSettings
}
export interface GitVersionOutput { export interface GitVersionOutput {
Major: number Major: number
Minor: number Minor: number

View File

@@ -1,27 +1,30 @@
import { IBuildAgent, TYPES } from '../../core/models' import { IBuildAgent } from '../../core/models'
import { ExecuteFields, GitVersionSettings, IGitVersionSettingsProvider } from './models' import { GitVersionSettings, ExecuteFields } from './models'
import { SettingsProvider } from '../common/settings'
import { inject, injectable } from 'inversify'
@injectable() export class Settings {
export class GitVersionSettingsProvider extends SettingsProvider implements IGitVersionSettingsProvider { public static getGitVersionSettings(
constructor(@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent) { buildAgent: IBuildAgent
super(buildAgent) ): GitVersionSettings {
} const targetPath = buildAgent.getInput(ExecuteFields.targetPath)
public getGitVersionSettings(): GitVersionSettings { const useConfigFile = buildAgent.getBooleanInput(
const targetPath = this.buildAgent.getInput(ExecuteFields.targetPath) ExecuteFields.useConfigFile
)
const configFilePath = buildAgent.getInput(ExecuteFields.configFilePath)
const useConfigFile = this.buildAgent.getBooleanInput(ExecuteFields.useConfigFile) const updateAssemblyInfo = buildAgent.getBooleanInput(
const configFilePath = this.buildAgent.getInput(ExecuteFields.configFilePath) ExecuteFields.updateAssemblyInfo
)
const updateAssemblyInfoFilename = buildAgent.getInput(
ExecuteFields.updateAssemblyInfoFilename
)
const updateAssemblyInfo = this.buildAgent.getBooleanInput(ExecuteFields.updateAssemblyInfo) const additionalArguments = buildAgent.getInput(
const updateAssemblyInfoFilename = this.buildAgent.getInput(ExecuteFields.updateAssemblyInfoFilename) ExecuteFields.additionalArguments
)
const additionalArguments = this.buildAgent.getInput(ExecuteFields.additionalArguments) const srcDir = buildAgent.getSourceDir()?.replace(/\\/g, '/')
const srcDir = this.buildAgent.getSourceDir()?.replace(/\\/g, '/')
return { return {
targetPath, targetPath,

View File

@@ -1,9 +1,10 @@
import { inject, injectable } from 'inversify' import path = require('path')
import { IBuildAgent, IExecResult, TYPES } from '../../core/models'
import { injectable, inject } from 'inversify'
import { IExecResult, IBuildAgent, TYPES, ISetupSettings } from '../../core/models'
import { DotnetTool, IDotnetTool } from '../../core/dotnet-tool' import { DotnetTool, IDotnetTool } from '../../core/dotnet-tool'
import { GitVersionOutput, GitVersionSettings } from './models' import { GitVersionSettings, GitVersionOutput } from './models'
import { IVersionManager } from '../../core/versionManager' import { IVersionManager } from '../../core/versionManager'
import { ISetupSettings } from '../common/models'
export interface IGitVersionTool extends IDotnetTool { export interface IGitVersionTool extends IDotnetTool {
install(setupSettings: ISetupSettings): Promise<void> install(setupSettings: ISetupSettings): Promise<void>
@@ -13,12 +14,19 @@ export interface IGitVersionTool extends IDotnetTool {
@injectable() @injectable()
export class GitVersionTool extends DotnetTool implements IGitVersionTool { export class GitVersionTool extends DotnetTool implements IGitVersionTool {
constructor(@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent, @inject(TYPES.IVersionManager) versionManager: IVersionManager) { constructor(
@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent,
@inject(TYPES.IVersionManager) versionManager: IVersionManager
) {
super(buildAgent, versionManager) super(buildAgent, versionManager)
} }
public async install(setupSettings: ISetupSettings): Promise<void> { public async install(setupSettings: ISetupSettings): Promise<void> {
await this.toolInstall('GitVersion.Tool', setupSettings) await this.toolInstall(
'GitVersion.Tool',
false,
setupSettings
)
} }
public run(options: GitVersionSettings): Promise<IExecResult> { public run(options: GitVersionSettings): Promise<IExecResult> {
@@ -44,16 +52,33 @@ export class GitVersionTool extends DotnetTool implements IGitVersionTool {
return workDir.replace(/\\/g, '/') return workDir.replace(/\\/g, '/')
} }
private getArguments(workDir: string, options: GitVersionSettings): string[] { private getArguments(
workDir: string,
options: GitVersionSettings
): string[] {
let args = [workDir, '/output', 'json', '/output', 'buildserver'] let args = [workDir, '/output', 'json', '/output', 'buildserver']
const { useConfigFile, configFilePath, updateAssemblyInfo, updateAssemblyInfoFilename, additionalArguments } = options const {
useConfigFile,
configFilePath,
updateAssemblyInfo,
updateAssemblyInfoFilename,
additionalArguments
} = options
if (useConfigFile) { if (useConfigFile) {
if (this.buildAgent.isValidInputFile('configFilePath', configFilePath)) { if (
this.buildAgent.isValidInputFile(
'configFilePath',
configFilePath
)
) {
args.push('/config', configFilePath) args.push('/config', configFilePath)
} else { } else {
throw new Error('GitVersion configuration file not found at ' + configFilePath) throw new Error(
'GitVersion configuration file not found at ' +
configFilePath
)
} }
} }
if (updateAssemblyInfo) { if (updateAssemblyInfo) {
@@ -61,10 +86,18 @@ export class GitVersionTool extends DotnetTool implements IGitVersionTool {
// You can specify 'updateAssemblyInfo' without 'updateAssemblyInfoFilename'. // You can specify 'updateAssemblyInfo' without 'updateAssemblyInfoFilename'.
if (updateAssemblyInfoFilename?.length > 0) { if (updateAssemblyInfoFilename?.length > 0) {
if (this.buildAgent.isValidInputFile('updateAssemblyInfoFilename', updateAssemblyInfoFilename)) { if (
this.buildAgent.isValidInputFile(
'updateAssemblyInfoFilename',
updateAssemblyInfoFilename
)
) {
args.push(updateAssemblyInfoFilename) args.push(updateAssemblyInfoFilename)
} else { } else {
throw new Error('AssemblyInfoFilename file not found at ' + updateAssemblyInfoFilename) throw new Error(
'AssemblyInfoFilename file not found at ' +
updateAssemblyInfoFilename
)
} }
} }
} }
@@ -149,9 +182,12 @@ export class GitVersionTool extends DotnetTool implements IGitVersionTool {
} }
private toCamelCase(input: string): string { private toCamelCase(input: string): string {
return input.replace(/^\w|[A-Z]|\b\w|\s+/g, function (match, index) { return input.replace(
if (+match === 0) return '' // or if (/\s+/.test(match)) for white spaces /(?:^\w|[A-Z]|\b\w|\s+)/g,
return index == 0 ? match.toLowerCase() : match.toUpperCase() function (match, index) {
}) if (+match === 0) return '' // or if (/\s+/.test(match)) for white spaces
return index == 0 ? match.toLowerCase() : match.toUpperCase()
}
)
} }
} }

View File

@@ -1,13 +1,13 @@
{ {
"compilerOptions": { "compilerOptions": {
"module": "ES2022", "module": "CommonJS",
"moduleResolution": "node", "moduleResolution": "node",
"target": "es2017", "target": "ES2016",
"noImplicitAny": true, "noImplicitAny": true,
"sourceMap": true, "sourceMap": true,
"lib": [ "ES2016" ], "lib": ["ES2016"],
"types": [ "reflect-metadata" ], "types": ["reflect-metadata"],
"esModuleInterop": true, "esModuleInterop":true,
"experimentalDecorators": true, "experimentalDecorators": true,
"emitDecoratorMetadata": true "emitDecoratorMetadata": true
} }

View File

@@ -7,7 +7,7 @@ function getConfig(mode, agent, entry) {
entry: entry, entry: entry,
target: 'node', target: 'node',
mode: mode, mode: mode,
devtool: mode === 'development' ? 'inline-source-map' : false, devtool: mode == 'development' ? 'inline-source-map' : false,
module: { module: {
rules: [{ rules: [{
test: /\.tsx?$/, test: /\.tsx?$/,
@@ -43,10 +43,7 @@ function getConfig(mode, agent, entry) {
replace: 'let pkg = { version: "1.2.3" };' replace: 'let pkg = { version: "1.2.3" };'
}] }]
}]) }])
], ]
experiments: {
topLevelAwait: true
}
} }
} }
@@ -65,12 +62,12 @@ const entryPoints = [
module.exports = (env) => { module.exports = (env) => {
const task = env.task || 'compile'; const task = env.task || 'compile';
const agent = env.agent || 'mock'; const agent = env.agent || 'mock';
const mode = task === 'compile' ? 'development' : 'production'; const mode = task == 'compile' ? 'development' : 'production';
const entry = {}; const entry = {};
entryPoints.forEach(key => { entryPoints.forEach(key => {
const resource = task === 'compile' ? `src/tasks/${key}.ts` : `dist/${agent}/${key}/bundle.js`; const resource = task == 'compile' ? `src/tasks/${key}.ts` : `dist/${agent}/${key}/bundle.js`;
entry[key] = path.resolve(__dirname, resource); entry[key] = path.resolve(__dirname, resource);
}); });
return getConfig(mode, agent, entry); return getConfig(mode, agent, entry);
}; };