Skip to content

feat(ci): publish dev builds to @coder/code-server-pr #4972

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

Merged
merged 14 commits into from
Mar 15, 2022

Conversation

jsjoeio
Copy link
Contributor

@jsjoeio jsjoeio commented Mar 9, 2022

This PR modifies the publish to npm workflow for development (commits to PRs and PRs) to use a different package name: @coder/code-server-pr as to not clutter the version list under the code-server name on npm.

Notes

Fixes #4924

TODOs

  • refactor to use jq instead of npm

@jsjoeio jsjoeio added the ci Issues related to ci label Mar 9, 2022
@jsjoeio jsjoeio self-assigned this Mar 9, 2022
@jsjoeio jsjoeio changed the title 4924 feat publish dev builds to @coder/code server pr feat(ci): publish dev builds to @coder/code-server-pr Mar 9, 2022
@codecov
Copy link

codecov bot commented Mar 9, 2022

Codecov Report

Merging #4972 (72d97a9) into main (d22f312) will not change coverage.
The diff coverage is n/a.

❗ Current head 72d97a9 differs from pull request most recent head c2c7845. Consider uploading reports for the commit c2c7845 to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #4972   +/-   ##
=======================================
  Coverage   71.58%   71.58%           
=======================================
  Files          29       29           
  Lines        1675     1675           
  Branches      373      373           
=======================================
  Hits         1199     1199           
  Misses        405      405           
  Partials       71       71           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d22f312...c2c7845. Read the comment docs.

@jsjoeio jsjoeio temporarily deployed to npm March 9, 2022 23:59 Inactive
@github-actions
Copy link

github-actions bot commented Mar 10, 2022

✨ code-server docs for PR #4972 is ready! It will be updated on every commit.

@jsjoeio jsjoeio marked this pull request as ready for review March 11, 2022 20:06
@jsjoeio jsjoeio requested a review from a team March 11, 2022 20:06
@jsjoeio jsjoeio temporarily deployed to npm March 11, 2022 20:16 Inactive
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Mar 11, 2022

In theory, this should work 🤔 But when I search

It does publish but it's using the old name 🤔
image

I think I know why. This line:

npm pkg set name="$DEV_PACKAGE_NAME"

Needs to be after the

pushd release

Because the package.json has to be in the current path from where you run npm pkg. I think the best approach is to set the default name to code-server then always set it with npm pkg (but open to other ideas). Something like:

DEV_PACKAGE_NAME="code-server"
if [[ "$NPM_ENVIRONMENT" == "development" ]]; then
  DEV_PACKAGE_NAME="@coder/code-server-pr"
fi

pushd release
npm pkg set name="$DEV_PACKAGE_NAME"
npm version "$NPM_VERSION"
popd

Though if we do that, then we'll need the v7/v8 npm CLI in any place we use this script 🤔 Which is fine but I'll need to update it in the npm-brew.yaml file.

@jsjoeio jsjoeio marked this pull request as draft March 11, 2022 20:34
@jsjoeio jsjoeio temporarily deployed to npm March 11, 2022 20:43 Inactive
@code-asher
Copy link
Member

The Brew workflow will not trigger this else branch right? Since NPM_ENVIRONMENT will be PRODUCTION.

@code-asher
Copy link
Member

Although the npm set is a great QOL improvement, maybe we should just use jq since we already use it elsewhere hahaha

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Mar 14, 2022

Although the npm set is a great QOL improvement, maybe we should just use jq since we already use it elsewhere hahaha

I'm all about those QOL improvements though 😛 Plus less tools/maintenance overhead only having to worry about npm

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Mar 14, 2022

The Brew workflow will not trigger this else branch right? Since NPM_ENVIRONMENT will be PRODUCTION.

Exactly!

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Mar 14, 2022

error Couldn't publish package: "https://registry.yarnpkg.com/@coder%2fcode-server-pr: You must sign up for private packages"
info Visit https://yarnpkg.com/en/docs/cli/publish for documentation about this command.

Looks like I may need to use a different npm token 🤔

@jsjoeio jsjoeio temporarily deployed to npm March 14, 2022 23:57 Inactive
@jsjoeio jsjoeio marked this pull request as ready for review March 15, 2022 16:38
@jsjoeio jsjoeio temporarily deployed to npm March 15, 2022 16:42 Inactive
@jsjoeio jsjoeio requested a review from code-asher March 15, 2022 19:52
@code-asher
Copy link
Member

code-asher commented Mar 15, 2022

Plus less tools/maintenance overhead only having to worry about npm

I think this is the main (only?) argument in favor, but since we already have jq as a dep it weakens the argument in this particular case (it also makes devs have to worry about updating npm which ends up adding burden for existing devs).

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Mar 15, 2022

I think this is the main (only?) argument in favor, but since we already have jq as a dep it weakens the argument in this particular case

Fair point! If I use jq, I don't have to use npm v7 or above, so that'd save time in the install steps. And we're all in favor of faster workflows

@jsjoeio jsjoeio marked this pull request as draft March 15, 2022 21:52
@code-asher
Copy link
Member

I think either way is not a big deal, the only pain point I can think of is if I have to release manually (like what happened last release 😢) then I would need to update node/npm so I can run it then downgrade it again (since code-server needs a lower version).

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Mar 15, 2022

I think either way is not a big deal, the only pain point I can think of is if I have to release manually (like what happened last release 😢) then I would need to update node/npm so I can run it then downgrade it again (since code-server needs a lower version).

Well technically you could upgrade npm only with npm i -g npm@7. Using a newer version of npm wouldn't affect your use of code-server, but agreed, it is one extra step and we should avoid it if we can!

@code-asher
Copy link
Member

Well technically you could upgrade npm only with npm i -g npm@7. Using a newer version of npm wouldn't affect your use of code-server, but agreed, it is one extra step and we should avoid it if we can!

🤯 Good point! That sounds like a pretty reasonable workaround IMO

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Mar 15, 2022

🤯 Good point! That sounds like a pretty reasonable workaround IMO

Well...you convinced me to use jq so I'm changing it 🤣 In all honesty though, you're right in that we should limit dependencies and using jq would be a smaller code change, which I think we're all in favor of. No biggie.

@code-asher
Copy link
Member

hahahahahaha well here is a heart for you <3

I look forward to the day we can remove jq tbh, maybe by writing the scripts in TypeScript or calling out to Node or something

@jsjoeio jsjoeio marked this pull request as ready for review March 15, 2022 22:58
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Mar 15, 2022

@code-asher bump

@jsjoeio jsjoeio temporarily deployed to npm March 15, 2022 23:24 Inactive
@jsjoeio jsjoeio merged commit a0561c7 into main Mar 15, 2022
@jsjoeio jsjoeio deleted the 4924-feat-publish-dev-builds-to-@coder/code-server-pr branch March 15, 2022 23:59
TinLe pushed a commit to TinLe/code-server that referenced this pull request Apr 23, 2022
* feat(npm): use DEV_PACKAGE_NAME for development

* feat(ci): use npm v7 in npm job

* fixup: add npm version

* fixup: always set package name

* wip

* fix: check for npm and npm v7

* fixup

* fixup: move after release dir created

* fixup: use jq

* fixup: use jq correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Issues related to ci
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat]: publish dev builds to @coder/code-server-pr
3 participants