Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 'Update latest tag on published packages' step #686

Closed
benmccann opened this issue Mar 25, 2021 · 9 comments
Closed

Remove 'Update latest tag on published packages' step #686

benmccann opened this issue Mar 25, 2021 · 9 comments
Labels
task Things that need to be done
Milestone

Comments

@benmccann
Copy link
Member

https://www.npmjs.com/package/@sveltejs/kit shows an old version of the README and people continually run into issues installing the latest instead of next package

@Rich-Harris
Copy link
Member

is that just a matter of removing --tag=next from

"release": "pnpm publish --tag=next --filter=\"@sveltejs/*\" --filter=\"create-svelte\""
? we can still stay in pre mode as far as changesets is concerned, and publish packages with a -next.n version suffix?

if so then 👍 this probably makes sense, though presumably we'd need to do some deprecated @next releases so that people are pointed towards latest? otherwise this would be equally confusing for the people currently using @next packages.

@pngwn
Copy link
Member

pngwn commented Mar 26, 2021

We need to call changeset publish to get other tags and releases in the repo rather than recursively publishing manually.

@Rich-Harris
Copy link
Member

but changeset publish would publish next tags because we're in prerelease mode, no? Will changeset publish respect the "private": true package.json fields?

@benmccann benmccann mentioned this issue Mar 26, 2021
Closed
@pngwn
Copy link
Member

pngwn commented Mar 26, 2021

But changeset publish would publish next tags because we're in prerelease mode, no?

You're right, i'm not sure how we add additional tags for specific releases, I'll look into that.

Will changeset publish respect the "private": true package.json fields?

It will, yes.

@benmccann benmccann changed the title Tag every package with latest Tag every package with latest and next Mar 27, 2021
@benmccann
Copy link
Member Author

pnpm publish might not let us add two tags, but we should be able to add a second tag after the package is published

@dominikg
Copy link
Member

dominikg commented Apr 6, 2022

we are using changeset publish and it is run by @changeset/action' here:

- name: Create Release Pull Request or Publish to npm

This action emits outputs that could be used to generate
npm dist-tag add package@version latest calls in a conditional step

- name: Tag published packages as latest too
        if: steps.changesets.outputs.published == 'true'
        # somehow take that json output of steps.changesets.outputs.publishedPackages and turn it into dist-tag commands
        run: # execute commands

problems:

  1. github actions expressions syntax is not a joy to work with
  2. running dist-tag shortly after publishing a version for the first time may fail if the registry hasn't propagated the new version.

edit:
to avoid having to deal with the json in the action itself it could be passed back to a script that makes the calls

- name: Tag published packages as latest too
        if: steps.changesets.outputs.published == 'true'
        run: node /scripts/add-latest-tag.js '${{steps.changesets.outputs.publishedPackages}}'

@Rich-Harris Rich-Harris changed the title Tag every package with latest and next Remove 'Update latest tag on published packages' step Apr 8, 2022
@Rich-Harris Rich-Harris added task Things that need to be done and removed meta labels Apr 8, 2022
@Rich-Harris
Copy link
Member

Rather than close this and create another issue, I've renamed the title to remind us to remove this stuff once we exit pre:

- name: Update latest tag on published packages # only needed until we release 1.0.0 and exit pre-release mode
if: steps.changesets.outputs.published == 'true'
# wait a bit and then run "npm dist-tag add package@version latest" for all published packages
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
published_packages: ${{steps.changesets.outputs.publishedPackages}}
run: |
sleep 20
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
echo $published_packages | jq -r 'map((.name + "@" + .version)) | .[]' | while read pkgver; do npm dist-tag add $pkgver latest || continue;done

@benmccann benmccann added this to the 1.0 milestone Apr 12, 2022
@didier
Copy link

didier commented Dec 14, 2022

@Rich-Harris Can we close this?

@dummdidumm
Copy link
Member

Yes we can :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Things that need to be done
Projects
None yet
Development

No branches or pull requests

7 participants