Skip to content

Commit

Permalink
test: update of docs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
WhereIsW4ldo committed Feb 7, 2025
1 parent eb050b7 commit c9d4571
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 1 deletion.
8 changes: 8 additions & 0 deletions dist/azure/gitversion/execute/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@
"required": false,
"helpMarkDown": "Update versions in specified file",
"visibleRule": "updateAssemblyInfo = true"
},
{
"name": "updateProjectFiles",
"type": "boolean",
"label": "Update project files",
"defaultValue": "false",
"required": false,
"helpMarkDown": "Whether to update versions in the project files"
}
]
}
21 changes: 21 additions & 0 deletions docs/examples/azure/gitversion/execute.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ updateAssemblyInfoFilename:
description: Update versions in specified file
required: false
default: ''
updateProjectFiles:
description: Whether to update versions in all project files
required: false
default: 'false'
```
## Outputs
Expand Down Expand Up @@ -487,3 +491,20 @@ stages:
```

</details>

### Example 10

<details>
<summary>Calculate the version for the build. Update the version in the project files.</summary>

```yaml
steps:
# gitversion/[email protected] task omitted for brevity.
- task: gitversion/[email protected]
displayName: Determine Version
inputs:
updateProjectFiles: true
```

</details>
21 changes: 21 additions & 0 deletions docs/examples/github/gitversion/execute.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ updateAssemblyInfoFilename:
description: Update versions in specified file
required: false
default: ''
updateProjectFiles:
description: Whether to update versions in the project files
required: false
default: 'false'
```
## Outputs
Expand Down Expand Up @@ -458,3 +462,20 @@ jobs:
```

</details>

### Example 9

<details>
<summary>Calculate the version for the build. Update the version in the project files.</summary>

```yaml
steps:
# gittools/actions/gitversion/[email protected] action omitted for brevity.
- name: Determine Version
uses: gittools/actions/gitversion/[email protected]
with:
updateProjectFiles: true
```

</details>
4 changes: 4 additions & 0 deletions gitversion/execute/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ inputs:
description: Update versions in specified file
required: false
default: ''
updateProjectFiles:
description: Whether to update versions in the project files
required: false
default: 'false'
outputs:
major: # id of output
description: 'The Major value'
Expand Down
3 changes: 2 additions & 1 deletion src/__tests__/tools/gitversion/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ describe('GitVersion settings', () => {
configFilePath: 'path',
overrideConfig: ['update-build-number=false'],
updateAssemblyInfo: true,
updateAssemblyInfoFilename: 'path'
updateAssemblyInfoFilename: 'path',
updateProjectFiles: true
}

const buildAgent = {
Expand Down
8 changes: 8 additions & 0 deletions src/__tests__/tools/gitversion/tool.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ describe('GitVersionTool', () => {
} as ExecuteSettings)
expect(args).toEqual(['workdir', '/output', 'json', '/l', 'console', '/config', 'workdir/GitVersion.yml', '/updateassemblyinfo', 'AssemblyInfo.cs'])
})

it('should return correct arguments for settings with project files', async () => {
tool.init(true)
const args = await tool.getExecuteArguments('workdir', {
updateProjectFiles: true
} as ExecuteSettings)
expect(args).toEqual(['workdir', '/output', 'json', '/l', 'console', '/updateprojectfiles'])
})
})

describe('getCommandArguments', () => {
Expand Down

0 comments on commit c9d4571

Please sign in to comment.