Skip to content

Commit

Permalink
feat: add support for multiple minimatch patterns (#36)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The assets upload input has been changed to multiLine type.

Resolves #34. Upgraded vsts-task-lib to newer azure-pipelines-task-lib and bumped
the major version of the task since this is a significant new feature to the API surface.
  • Loading branch information
heaths authored and marceloavf committed Oct 28, 2018
1 parent ba6266f commit 43e238c
Show file tree
Hide file tree
Showing 9 changed files with 1,331 additions and 75 deletions.
12 changes: 11 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
"ideas",
"infra"
]
},
{
"login": "heaths",
"name": "Heath Stewart",
"avatar_url": "https://avatars1.githubusercontent.com/u/1532486?v=4",
"profile": "https://blogs.msdn.microsoft.com/heaths/",
"contributions": [
"code"
]
}
]
],
"repoType": "github"
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ If you'd like to make some changes yourself, see the following:
3. Run `yarn` to download required packages
4. Build the application: `yarn build`
5. Follow [Commit message guidelines](https://github.com/semantic-release/semantic-release/blob/caribou/CONTRIBUTING.md#commit-message-guidelines) from Semantic-release
6. If you contributed something new, run `yarn contrib:add <your GitHub username>` to add yourself [below](#contributors)
6. If you contributed something new, run `yarn contributors:add <your GitHub username>` to add yourself [below](#contributors)
7. Finally, submit a [pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) with your changes!
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
| [<img src="https://avatars3.githubusercontent.com/u/5435657?v=4" width="100px;"/><br /><sub><b>Marcelo Formentão</b></sub>](https://github.com/marceloavf)<br />[💻](https://github.com/marceloavf/github-tools-vsts/commits?author=marceloavf "Code") [🎨](#design-marceloavf "Design") [📖](https://github.com/marceloavf/github-tools-vsts/commits?author=marceloavf "Documentation") [🤔](#ideas-marceloavf "Ideas, Planning, & Feedback") [🚇](#infra-marceloavf "Infrastructure (Hosting, Build-Tools, etc)") |
| :---: |
| [<img src="https://avatars3.githubusercontent.com/u/5435657?v=4" width="100px;"/><br /><sub><b>Marcelo Formentão</b></sub>](https://www.github.com/marceloavf)<br />[💻](https://github.com/marceloavf/github-tools-vsts/commits?author=marceloavf "Code") [🎨](#design-marceloavf "Design") [📖](https://github.com/marceloavf/github-tools-vsts/commits?author=marceloavf "Documentation") [🤔](#ideas-marceloavf "Ideas, Planning, & Feedback") [🚇](#infra-marceloavf "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars1.githubusercontent.com/u/1532486?v=4" width="100px;"/><br /><sub><b>Heath Stewart</b></sub>](https://blogs.msdn.microsoft.com/heaths/)<br />[💻](https://github.com/marceloavf/github-tools-vsts/commits?author=heaths "Code") |
| :---: | :---: |
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
12 changes: 6 additions & 6 deletions Src/GithubReleasePublish/githubReleasePublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import objectDifference from 'CommonNode/objectDifference.js'
let editObject
let githubEndpointToken

const glob = require('glob')
const publishRelease = require('publish-release')
const tl = require('vsts-task-lib/task')
const tl = require('azure-pipelines-task-lib/task')

/** Endpoint */
const githubEndpoint = tl.getInput('githubEndpoint')
Expand Down Expand Up @@ -38,7 +37,7 @@ const githubDeleteEmptyTag = tl.getBoolInput('githubDeleteEmptyTag')

/** Paths */
const manifestJson = tl.getPathInput('manifestJson')
let githubReleaseAsset = tl.getPathInput('githubReleaseAsset')
let githubReleaseAssets = tl.getDelimitedInput('githubReleaseAsset', '\n', !githubIgnoreAssets)

/** Check for options in manifest if they don't exists on input */
const manifestOptions = readManifest(manifestJson)
Expand All @@ -57,8 +56,9 @@ if (githubEndpointObject.scheme === 'PersonalAccessToken') {
/** Check for one or multiples files into array
* Accept wildcards to look for files
*/
if (githubReleaseAsset && !githubIgnoreAssets) {
githubReleaseAsset = glob.sync(githubReleaseAsset)
if (githubReleaseAssets && !githubIgnoreAssets) {
// defaults to $(System.DefaultWorkingDirectory)
githubReleaseAssets = tl.findMatch(undefined, githubReleaseAssets)
}

/**
Expand Down Expand Up @@ -87,7 +87,7 @@ options.draft = !!githubReleaseDraft // If missing it's false
options.prerelease = !!githubReleasePrerelease // If missing it's false
options.reuseRelease = !!githubReuseRelease // If you don't want the plugin to create a new release if one already exists for the given tag.
options.reuseDraftOnly = !!githubReuseDraftOnly // If you only want to reuse a release if it's a draft. It prevents you from editing already published releases.
options.assets = githubIgnoreAssets ? undefined : githubReleaseAsset // Assets array
options.assets = githubIgnoreAssets ? undefined : githubReleaseAssets // Assets array
options.apiUrl = githubApiUrl || 'https://api.github.com' // Use a custom API URL to connect to GitHub Enterprise instead of github.com.
options.target_commitish = githubTargetCommitsh || 'master' // Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA.
options.skipDuplicatedAssets = !!githubSkipDuplicatedAssets // Prevent the plugin to replace assets with the same name. False by default.
Expand Down
71 changes: 13 additions & 58 deletions Src/GithubReleasePublish/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Src/GithubReleasePublish/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"dependencies": {
"glob": "^7.1.2",
"publish-release": "^1.5.1",
"vsts-task-lib": "^2.1.0"
"azure-pipelines-task-lib": "^2.7.1"
}
}
6 changes: 3 additions & 3 deletions Src/GithubReleasePublish/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"[More Information](https://github.com/marceloavf/github-tools-vsts) (Version #{Version}#).",
"category": "Utility",
"version": {
"Major": 0,
"Major": 1,
"Minor": 0,
"Patch": 0
},
Expand Down Expand Up @@ -126,11 +126,11 @@
},
{
"name": "githubReleaseAsset",
"type": "input",
"type": "multiLine",
"label": "Files to Upload as Assets",
"required": true,
"visibleRule": "githubIgnoreAssets = false",
"helpMarkDown": "The file to upload as artifacts to the release. Minimatch patterns are supported. <br>For example: <strong>$(System.DefaultWorkingDirectory)/**/*.exe</strong>"
"helpMarkDown": "The files to upload as artifacts to the release. Multiple minimatch patterns are supported. [More information](https://aka.ms/minimatchexamples)"
},
{
"name": "manifestJson",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "github-tools-vsts",
"version": "0.5.0",
"version": "1.0.0",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -26,6 +26,7 @@
},
"dependencies": {
"@semantic-release/changelog": "^1.0.0",
"azure-pipelines-task-lib": "^2.7.1",
"deep-object-diff": "^1.1.0",
"js-object-pretty-print": "^0.3.0"
},
Expand Down
Loading

0 comments on commit 43e238c

Please sign in to comment.