changesets / action

650 stars 228 forks source link

Publishing does not replace `workspace:*` version #246

Open emmenko opened 1 year ago

emmenko commented 1 year ago

Hi 👋

I started using the workspace: protocol in one of my repos but noticed that when publishing the version didn't get replaced, ending up with a broken release.

image

Is this a known issue? Is there anything that I'm missing that I need to configure?

Thanks


I'm using Yarn v3.

My github action is configured like this:

- name: Creating release pull request or publishing release to npm registry
  id: changesets
  # uses: changesets/action@v1.3.0
  uses: dotansimha/changesets-action@v1.3.3
  with:
    publish: yarn changeset publish
    version: yarn changeset:version-and-format
    commit: 'ci(changesets): version packages'
    createGithubReleases: aggregate
    githubReleaseName: v${{ steps.release_version.outputs.VALUE }}
    githubTagName: v${{ steps.release_version.outputs.VALUE }}
  env:
    GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
    SKIP_POSTINSTALL_DEV_SETUP: true

My Changesets config is configured like this.

trivikr commented 1 year ago

Looks like this issue was reported earlier, but no response:

Andarist commented 1 year ago

This is being fixed by https://github.com/changesets/changesets/pull/674 - unfortunately, I couldn't find time to finish that work.

mkurapov commented 1 year ago

@emmenko does it work if you replace "package": "workspace:*" with the actual version of the workspace dependency, ie: "package": "workspace:1.0.0"? Changesets should end up bumping the workspace dependency version automatically when running changeset version, e.g. "package": "workspace:1.0.1"

adesso-os commented 1 year ago

When you specify the actual version number, then that version number is pulled during installation and placed into node_modules. Usually, developers don't want that. They want the actual project from the other workspace linked into NM. That is what workspace:* provides, but then changesets breaks.

mkurapov commented 1 year ago

@adesso-os

then that version number is pulled during installation and placed into node_modules

This is true for "package": "1.0.0", which will install from the registry, but it should still be linked locally if using the workspace protocol (while specifying a specific version), eg. "package": "workspace:1.0.0". (unless I'm misunderstanding here)

unional commented 1 year ago

workspace:^

arthurfiorette commented 10 months ago

Hey folks! I could get everything working fine by using this custom release script:

"ci:publish": "pnpm publish -r --access public && changeset tag",

In case someone actually wants to see it in action:

https://github.com/kitajs/kitajs/blob/e96dc95033e58c9a3a49ab8246ebc085b83a937b/.github/workflows/main.yml#L59 https://github.com/kitajs/kitajs/blob/e96dc95033e58c9a3a49ab8246ebc085b83a937b/package.json#L21

workspace:^, dependencies, scoped packages and github releases are working 🙏.

arthurfiorette commented 5 months ago

Appearently the above does not works uses the correct dist-tag when publishing...

image

As you can see, the version 4.0.0-next.0 wasn't published with the next tag. That's not a problem as you can change this manually with the npm dist-tag add @kitajs/html@4.0.0-next.0 next and npm dist-tag add @kitajs/html@3.1.2 latest commands

mattfysh commented 2 months ago

why does the changeset tool only half-work with the workspace protocol? i.e. bumps during version but doesn't support a subsequent publish?