Skip to content

Commit

Permalink
fix: use releases instead of release
Browse files Browse the repository at this point in the history
  • Loading branch information
uetchy committed Oct 16, 2019
1 parent 1fc19c4 commit c9de95f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/shipjs-lib/src/lib/config/defaultConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default {
],
}),
},
release: {
releases: {
assetsToUpload: [],
},
};
23 changes: 13 additions & 10 deletions packages/shipjs/src/step/release/createGitHubRelease.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default async ({ version, config, dir, dryRun }) =>
await runStep(
{ title: 'Creating a release on GitHub repository' },
async ({ run }) => {
const { getTagName, release } = config;
const { getTagName, releases } = config;
const tagName = getTagName({ version });
const args = [];

Expand All @@ -42,24 +42,27 @@ export default async ({ version, config, dir, dryRun }) =>
args.push(`-F ${exportedPath}`);

// handle assets
if (release && release.assetsToUpload) {
const option = release.assetsToUpload;
if (releases && releases.assetsToUpload) {
const option = releases.assetsToUpload;
const assetPaths = [];

if (Array.isArray(option) && option.length > 0) {
// list
for (const asset of option) {
const files = await globby(asset);
assetPaths.push(...files);
}
} else if (typeof option === 'function') {
if (typeof option === 'function') {
// function
// assetsToUpload: ({dir, version, tagName}) => [...]
const files = await Promise.resolve(
option({ dir, version, tagName })
);
assetPaths.push(...files);
} else if (Array.isArray(option) && option.length > 0) {
// list
// assetsToUpload: ['package.json', 'dist/*.zip']
for (const asset of option) {
const files = await globby(asset);
assetPaths.push(...files);
}
} else if (typeof option === 'string') {
// string
// assetsToUpload: 'archive.zip'
assetPaths.push(option);
}

Expand Down

0 comments on commit c9de95f

Please sign in to comment.