semantic-release-vsce 5.0.18 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ name: dependabot-auto-merge
2
+ on: pull_request
3
+
4
+ permissions:
5
+ contents: write
6
+
7
+ jobs:
8
+ dependabot-auto-merge:
9
+ runs-on: ubuntu-latest
10
+ if: github.actor == 'dependabot[bot]'
11
+ steps:
12
+ - name: Get Dependabot metadata
13
+ id: metadata
14
+ uses: dependabot/fetch-metadata@v1
15
+ with:
16
+ github-token: ${{ secrets.GITHUB_TOKEN }}
17
+ - name: Enable auto-merge for Dependabot PRs
18
+ if: steps.metadata.outputs.dependency-type == 'direct:development' && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch')
19
+ run: gh pr merge --auto --squash "$PR_URL"
20
+ env:
21
+ PR_URL: ${{ github.event.pull_request.html_url }}
22
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package/README.md CHANGED
@@ -62,13 +62,14 @@ The plugin can be configured in the [**semantic-release** configuration file](ht
62
62
  | Option | Type | Description |
63
63
  | ------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
64
64
  | `packageVsix` | `boolean` or `string` | If set to `true`, the plugin will generate a `.vsix` file. If is a string, it will be used as value for `--out` of `vsce package`. |
65
+ | `publish` | `boolean` | The plugin will publish the package unless this option is set to `false`, in which case it will only package the extension `vsix`. |
65
66
 
66
67
  ### Environment Variables
67
68
 
68
- | Variable | Description |
69
- | ---------- | --------------------------------------------------------------------------------------- |
70
- | `VSCE_PAT` | **Required**. The personal access token to publish the extension of VS Code Marketplace |
71
- | `OVSX_PAT` | _Optional_. The personal access token to push to OpenVSX |
69
+ | Variable | Description |
70
+ | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |
71
+ | `VSCE_PAT` | _**Required**_ unless `publish` is set to `false`. The personal access token to publish the extension of VS Code Marketplace |
72
+ | `OVSX_PAT` | _Optional_. The personal access token to push to OpenVSX |
72
73
 
73
74
  ### Publishing to OpenVSX
74
75
 
package/index.js CHANGED
@@ -7,7 +7,7 @@ let prepared = false;
7
7
  let packagePath;
8
8
 
9
9
  async function verifyConditions (pluginConfig, { logger }) {
10
- await verifyVsce(logger);
10
+ await verifyVsce(logger, pluginConfig);
11
11
  verified = true;
12
12
  }
13
13
 
@@ -30,6 +30,12 @@ async function publish (pluginConfig, { nextRelease: { version }, logger }) {
30
30
  // BC: prior to semantic-release v15 prepare was part of publish
31
31
  packagePath = await vscePrepare(version, pluginConfig.packageVsix, logger);
32
32
  }
33
+
34
+ // If publishing is disabled, return early.
35
+ if (pluginConfig?.publish === false) {
36
+ return;
37
+ }
38
+
33
39
  return vscePublish(version, packagePath, logger);
34
40
  }
35
41
 
package/lib/verify.js CHANGED
@@ -2,10 +2,11 @@ const verifyPkg = require('./verify-pkg');
2
2
  const verifyAuth = require('./verify-auth');
3
3
  const verifyOvsxAuth = require('./verify-ovsx-auth');
4
4
 
5
- module.exports = async logger => {
5
+ module.exports = async (logger, pluginConfig) => {
6
6
  await verifyPkg();
7
7
 
8
- await verifyAuth(logger);
9
-
10
- await verifyOvsxAuth(logger);
8
+ if (pluginConfig?.publish !== false) {
9
+ await verifyAuth(logger);
10
+ await verifyOvsxAuth(logger);
11
+ }
11
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semantic-release-vsce",
3
- "version": "5.0.18",
3
+ "version": "5.1.0",
4
4
  "description": "semantic-release plugin to package and publish VS Code extensions",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -139,3 +139,18 @@ test('publish that is already verified & prepared', async t => {
139
139
  semanticReleasePayload.logger
140
140
  ]);
141
141
  });
142
+
143
+ test('it does not publish the package if publishing is disabled', async t => {
144
+ const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
145
+ const { prepare, publish, verifyConditions } = proxyquire('../index.js', {
146
+ './lib/verify': verifyVsceStub,
147
+ './lib/publish': vscePublishStub,
148
+ './lib/prepare': vscePrepareStub
149
+ });
150
+
151
+ await verifyConditions({ ...pluginConfig, publish: false }, semanticReleasePayload);
152
+ await prepare({ ...pluginConfig, publish: false }, semanticReleasePayload);
153
+ await publish({ ...pluginConfig, publish: false }, semanticReleasePayload);
154
+
155
+ t.true(vscePublishStub.notCalled);
156
+ });
@@ -32,3 +32,21 @@ test('rejects with verify-pkg', async t => {
32
32
 
33
33
  await t.throwsAsync(() => verify(logger));
34
34
  });
35
+
36
+ test('is does not verify the auth tokens if publishing is disabled', async t => {
37
+ const stubs = {
38
+ verifyPkgStub: sinon.stub().resolves(),
39
+ verifyAuthStub: sinon.stub().resolves(),
40
+ verifyOvsxAuthStub: sinon.stub().resolves()
41
+ };
42
+ const verify = proxyquire('../lib/verify', {
43
+ './verify-pkg': stubs.verifyPkgStub,
44
+ './verify-auth': stubs.verifyAuthStub,
45
+ './verify-ovsx-auth': stubs.verifyOvsxAuthStub
46
+ });
47
+
48
+ await verify(logger, { publish: false });
49
+
50
+ t.true(stubs.verifyAuthStub.notCalled);
51
+ t.true(stubs.verifyOvsxAuthStub.notCalled);
52
+ });