-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow to publish to Open VSX only (#488)
Signed-off-by: dankeboy36 <dankeboy36@gmail.com> Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
- Loading branch information
1 parent
03b0293
commit 28338a6
Showing
13 changed files
with
325 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,38 @@ | ||
// @ts-check | ||
|
||
const SemanticReleaseError = require('@semantic-release/error'); | ||
const verifyPkg = require('./verify-pkg'); | ||
const verifyAuth = require('./verify-auth'); | ||
const verifyVsceAuth = require('./verify-vsce-auth'); | ||
const verifyOvsxAuth = require('./verify-ovsx-auth'); | ||
const verifyTarget = require('./verify-target'); | ||
const { isOvsxPublishEnabled, isVscePublishEnabled } = require('./utils'); | ||
|
||
module.exports = async (pluginConfig, { logger, cwd }) => { | ||
await verifyPkg(); | ||
await verifyTarget(); | ||
|
||
if (pluginConfig?.publish !== false) { | ||
await verifyAuth(logger, cwd); | ||
await verifyOvsxAuth(logger, cwd); | ||
const vscePublishEnabled = isVscePublishEnabled(); | ||
const ovsxPublishEnabled = isOvsxPublishEnabled(); | ||
if (!vscePublishEnabled && !ovsxPublishEnabled) { | ||
throw new SemanticReleaseError( | ||
'No personal access token was detected. Set the `VSCE_PAT` or the `OVSX_PAT` environment variable, at least one of them must be present when publish is enabled.\nLearn more at https://github.com/felipecrs/semantic-release-vsce#publishing', | ||
'ENOPAT', | ||
); | ||
} | ||
if (vscePublishEnabled) { | ||
await verifyVsceAuth(logger, cwd); | ||
} else { | ||
logger.log( | ||
'Skipping verification of the vsce personal access token as the `VSCE_PAT` environment variable is not set.\n\nDid you know you can easily start publishing to Visual Studio Marketplace with `semantic-release-vsce`?\nLearn more at https://github.com/felipecrs/semantic-release-vsce#publishing-to-visual-studio-marketplace', | ||
); | ||
} | ||
if (ovsxPublishEnabled) { | ||
await verifyOvsxAuth(logger, cwd); | ||
} else { | ||
logger.log( | ||
'Skipping verification of the ovsx personal access token as the `OVSX_PAT` environment variable is not set.\n\nDid you know you can easily start publishing to Open VSX Registry with `semantic-release-vsce`?\nLearn more at https://github.com/felipecrs/semantic-release-vsce#publishing-to-open-vsx-registry', | ||
); | ||
} | ||
} | ||
}; |
Oops, something went wrong.