HaaLeo / publish-vscode-extension

GitHub action to publish your VS Code Extension to the Open VSX Registry or Visual Studio Marketplace.
MIT License
209 stars 13 forks source link

Workflow fails when snippets package version is already in the registry #38

Closed PieterjanDeClippel closed 1 year ago

PieterjanDeClippel commented 1 year ago
publish-vscode-extension Version Operating System
v1 ubuntu-latest

Description

Adding more on this issue. IMHO the workflow should not error when a package version already exists in the registry. I have a monorepo with multiple libraries and one snippets package. Making changes to a library makes the workflow fail since the snippets package wasn't modified, and thus is still on the same version.

Expected Behavior

The workflow should succeed also when the snippets extension is already in the registry.

Actual Behavior

The workflow fails when changing other files in the workspace

image

Steps to Reproduce

Everything is hosted here Error is thrown here

        if (extension && extension.versions) {
            const sameVersion = extension.versions.filter(v => v.version === manifest.version);
            if (sameVersion.length > 0) {
                if (options.skipDuplicate) {
                    util_2.log.done(`Version ${manifest.version} is already published. Skipping publish.`);
                    return;
                }
                if (sameVersion.some(v => v.targetPlatform === options.target)) {
/* Here */          throw new Error(`${description} already exists.`);
                }
            }
            try {
                await api.updateExtension(undefined, packageStream, manifest.publisher, manifest.name);
            }
            catch (err) {

This code comes from here

Context

Run HaaLeo/publish-vscode-extension@v1
  with:
    packagePath: libs/mintplayer-ng-bootstrap-snippets
    pat: ***
    registryUrl: https://marketplace.visualstudio.com
    yarn: false
    dryRun: false
    noVerify: false
    preRelease: false
    dependencies: true
Specifically, running GitHub Action HaaLeo/publish-vscode-extension@v1.3.0.
Package the Extension
Publish the Extension
Error: Error: MintPlayer.mintplayer-ng-bootstrap-snippets v16.0.1 already exists.
    at _publish (/home/runner/work/_actions/HaaLeo/publish-vscode-extension/v1/dist/index.js:5098:[2](https://github.com/MintPlayer/mintplayer-ng-bootstrap/actions/runs/5065996309/jobs/9095228526#step:36:2)7)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async publish (/home/runner/work/_actions/HaaLeo/publish-vscode-extension/v1/dist/index.js:50[3](https://github.com/MintPlayer/mintplayer-ng-bootstrap/actions/runs/5065996309/jobs/9095228526#step:36:3)[7](https://github.com/MintPlayer/mintplayer-ng-bootstrap/actions/runs/5065996309/jobs/9095228526#step:36:7):13)
HaaLeo commented 1 year ago

hi @PieterjanDeClippel thx for your contribution. I cannot say when I am gonna have time to review the PR. Therefore, I kindly ask you to be patient until I reviewed it.

HaaLeo commented 1 year ago

released with v1.4.0