@semantic-release/github
Advanced tools
Comparing version 1.0.0 to 2.0.0
19
index.js
@@ -1,11 +0,10 @@ | ||
const {callbackify} = require('util'); | ||
const verifyGithub = require('./lib/verify'); | ||
const publishGit = require('./lib/publish'); | ||
const publishGithub = require('./lib/publish'); | ||
let verified; | ||
async function verifyConditions(pluginConfig, {pkg, options: {publish}}) { | ||
async function verifyConditions(pluginConfig, {options}) { | ||
// If the Github publish plugin is used and has `assets` configured, validate it now in order to prevent any release if the configuration is wrong | ||
if (publish) { | ||
const publishPlugin = (Array.isArray(publish) ? publish : [publish]).find( | ||
if (options.publish) { | ||
const publishPlugin = (Array.isArray(options.publish) ? options.publish : [options.publish]).find( | ||
config => config.path && config.path === '@semantic-release/github' | ||
@@ -18,14 +17,14 @@ ); | ||
await verifyGithub(pluginConfig, pkg); | ||
await verifyGithub(pluginConfig, options); | ||
verified = true; | ||
} | ||
async function publish(pluginConfig, {pkg, nextRelease, options, logger}) { | ||
async function publish(pluginConfig, {nextRelease, options, logger}) { | ||
if (!verified) { | ||
await verifyGithub(pluginConfig, pkg); | ||
await verifyGithub(pluginConfig, options); | ||
verified = true; | ||
} | ||
await publishGit(pluginConfig, options, pkg, nextRelease, logger); | ||
await publishGithub(pluginConfig, options, nextRelease, logger); | ||
} | ||
module.exports = {verifyConditions: callbackify(verifyConditions), publish: callbackify(publish)}; | ||
module.exports = {verifyConditions, publish}; |
const {basename} = require('path'); | ||
const {parse} = require('url'); | ||
const {stat} = require('fs-extra'); | ||
const gitUrlParse = require('git-url-parse'); | ||
const parseGithubUrl = require('parse-github-url'); | ||
const GitHubApi = require('github'); | ||
const resolveConfig = require('./resolve-config'); | ||
const pEachSeries = require('p-each-series'); | ||
const debug = require('debug')('semantic-release:publish-github'); | ||
const resolveConfig = require('./resolve-config'); | ||
module.exports = async (pluginConfig, {branch}, {repository}, {version, gitHead, gitTag, notes}, logger) => { | ||
module.exports = async (pluginConfig, {branch, repositoryUrl}, {version, gitHead, gitTag, notes}, logger) => { | ||
const {githubToken, githubUrl, githubApiPathPrefix, assets} = resolveConfig(pluginConfig); | ||
const {name: repo, owner} = gitUrlParse(repository.url); | ||
const {name: repo, owner} = parseGithubUrl(repositoryUrl); | ||
let {port, protocol, hostname: host} = githubUrl ? parse(githubUrl) : {}; | ||
@@ -19,3 +19,3 @@ protocol = (protocol || '').split(':')[0] || null; | ||
const release = {owner, repo, tag_name: gitTag, name: gitTag, target_commitish: branch, body: notes}; | ||
const release = {owner, repo, tag_name: gitTag, name: gitTag, target_commitish: branch, body: notes}; // eslint-disable-line camelcase | ||
debug('release owner: %o', owner); | ||
@@ -29,3 +29,3 @@ debug('release repo: %o', repo); | ||
await github.gitdata.createReference({owner, repo, ref, sha: gitHead}); | ||
const {data: {id, html_url}} = await github.repos.createRelease(release); | ||
const {data: {id, html_url}} = await github.repos.createRelease(release); // eslint-disable-line camelcase | ||
logger.log('Published Github release: %s', html_url); | ||
@@ -56,3 +56,3 @@ | ||
const {data: {browser_download_url}} = await github.repos.uploadAsset(upload); | ||
const {data: {browser_download_url}} = await github.repos.uploadAsset(upload); // eslint-disable-line camelcase | ||
logger.log('Published file %s', browser_download_url); | ||
@@ -59,0 +59,0 @@ }); |
const {parse} = require('url'); | ||
const gitUrlParse = require('git-url-parse'); | ||
const parseGithubUrl = require('parse-github-url'); | ||
const GitHubApi = require('github'); | ||
const SemanticReleaseError = require('@semantic-release/error'); | ||
const resolveConfig = require('./resolve-config'); | ||
const SemanticReleaseError = require('@semantic-release/error'); | ||
module.exports = async (pluginConfig, {name, repository}) => { | ||
module.exports = async (pluginConfig, {repositoryUrl}) => { | ||
const {githubToken, githubUrl, githubApiPathPrefix, assets} = resolveConfig(pluginConfig); | ||
if (!name) { | ||
throw new SemanticReleaseError('No "name" found in package.json.', 'ENOPKGNAME'); | ||
} | ||
if (!repository || !repository.url) { | ||
throw new SemanticReleaseError('No "repository" found in package.json.', 'ENOPKGREPO'); | ||
} | ||
if (!githubToken) { | ||
@@ -32,3 +24,10 @@ throw new SemanticReleaseError('No github token specified.', 'ENOGHTOKEN'); | ||
const {name: repo, owner} = gitUrlParse(repository.url); | ||
const {name: repo, owner} = parseGithubUrl(repositoryUrl); | ||
if (!owner || !repo) { | ||
throw new SemanticReleaseError( | ||
`The git repository URL ${repositoryUrl} is not a valid Github URL.`, | ||
'EINVALIDGITURL' | ||
); | ||
} | ||
let {port, protocol, hostname: host} = githubUrl ? parse(githubUrl) : {}; | ||
@@ -35,0 +34,0 @@ protocol = (protocol || '').split(':')[0] || null; |
@@ -1,1 +0,1 @@ | ||
{"name":"@semantic-release/github","description":"Set of semantic-release plugins for publishing a Github release","version":"1.0.0","author":"Pierre Vanduynslager (https://twitter.com/@pvdlg_)","bugs":{"url":"https://github.com/semantic-release/github/issues"},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"contributors":["Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)","Gregor Martynus (https://twitter.com/gr2m)"],"dependencies":{"@semantic-release/error":"^2.1.0","debug":"^3.1.0","fs-extra":"^4.0.2","git-url-parse":"^7.0.1","github":"^12.0.3","p-each-series":"^1.0.0"},"devDependencies":{"ava":"^0.23.0","clear-module":"^2.1.0","codecov":"^3.0.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint":"^4.11.0","eslint-config-prettier":"^2.8.0","eslint-config-standard":"^10.2.1","eslint-plugin-import":"^2.7.0","eslint-plugin-node":"^5.2.0","eslint-plugin-prettier":"^2.3.0","eslint-plugin-promise":"^3.5.0","eslint-plugin-standard":"^3.0.1","nock":"^9.1.0","nyc":"^11.2.1","prettier":"~1.8.2","rimraf":"^2.5.0","semantic-release":"^9.1.1","sinon":"^4.0.0"},"engines":{"node":">=4"},"eslintConfig":{"extends":["standard","prettier"],"plugins":["prettier"],"rules":{"prettier/prettier":2}},"files":["lib","index.js"],"homepage":"https://github.com/semantic-release/github#readme","keywords":["git","github","publish","release","semantic-release","version"],"license":"MIT","main":"index.js","nyc":{"include":["lib/**/*.js","index.js"],"reporter":["json","text","html"],"all":true},"prettier":{"printWidth":120,"singleQuote":true,"bracketSpacing":false,"trailingComma":"es5"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/semantic-release/github.git"},"scripts":{"clean":"rimraf coverage && rimraf .nyc_output","cm":"git-cz","codecov":"codecov -f coverage/coverage-final.json","lint":"eslint test lib index.js","pretest":"npm run clean && npm run lint","semantic-release":"semantic-release","test":"nyc ava -v"}} | ||
{"name":"@semantic-release/github","description":"Set of semantic-release plugins for publishing a Github release","version":"2.0.0","author":"Pierre Vanduynslager (https://twitter.com/@pvdlg_)","bugs":{"url":"https://github.com/semantic-release/github/issues"},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"contributors":["Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)","Gregor Martynus (https://twitter.com/gr2m)"],"dependencies":{"@semantic-release/error":"^2.1.0","debug":"^3.1.0","fs-extra":"^4.0.2","github":"^12.0.5","p-each-series":"^1.0.0","parse-github-url":"^1.0.1"},"devDependencies":{"ava":"^0.23.0","clear-module":"^2.1.0","codecov":"^3.0.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint-config-prettier":"^2.8.0","eslint-plugin-prettier":"^2.3.0","nock":"^9.1.0","nyc":"^11.2.1","prettier":"~1.8.2","semantic-release":"^10.0.0","sinon":"^4.0.0","xo":"^0.18.2"},"engines":{"node":">=4"},"files":["lib","index.js"],"homepage":"https://github.com/semantic-release/github#readme","keywords":["git","github","publish","release","semantic-release","version"],"license":"MIT","main":"index.js","nyc":{"include":["lib/**/*.js","index.js"],"reporter":["json","text","html"],"all":true},"prettier":{"printWidth":120,"singleQuote":true,"bracketSpacing":false,"trailingComma":"es5"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/semantic-release/github.git"},"scripts":{"cm":"git-cz","codecov":"codecov -f coverage/coverage-final.json","lint":"xo","pretest":"npm run lint","semantic-release":"semantic-release","test":"nyc ava -v"},"xo":{"extends":["prettier"],"plugins":["prettier"],"rules":{"prettier/prettier":2}}} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13
13392
130
+ Addedparse-github-url@^1.0.1
+ Addedparse-github-url@1.0.3(transitive)
- Removedgit-url-parse@^7.0.1
- Removedgit-up@2.1.0(transitive)
- Removedgit-url-parse@7.2.0(transitive)
- Removedis-plain-obj@1.1.0(transitive)
- Removedis-ssh@1.4.0(transitive)
- Removednormalize-url@1.9.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedparse-path@3.0.4(transitive)
- Removedparse-url@3.0.2(transitive)
- Removedprepend-http@1.0.4(transitive)
- Removedprotocols@1.4.82.0.1(transitive)
- Removedquery-string@4.3.4(transitive)
- Removedsort-keys@1.1.2(transitive)
- Removedstrict-uri-encode@1.1.0(transitive)
Updatedgithub@^12.0.5