Skip to content

Make src-cli installable via npm.#760

Merged
olafurpg merged 2 commits into
mainfrom
olafurpg/npm-distribution
Jun 2, 2022
Merged

Make src-cli installable via npm.#760
olafurpg merged 2 commits into
mainfrom
olafurpg/npm-distribution

Conversation

@olafurpg

@olafurpg olafurpg commented Jun 2, 2022

Copy link
Copy Markdown
Contributor

Fixes #759. Previously, the recommended way to install src-cli on Linux
was to download a static binary via curl. This PR makes it possible to
install src-cli via npm install -g @sourcegraph/src. The new npm
distribution will be particuarly helpful for users of our new
scip-typescript and scip-python indexers that are also distributed via
npm.

Test plan

Manually ran yarn install in the npm-distribution directory to verify that it works as expected. There's no reliable way to test this change without trying to run the actual release step to npmjs.com.

@olafurpg olafurpg requested a review from eseliger June 2, 2022 10:30
@olafurpg olafurpg force-pushed the olafurpg/npm-distribution branch from c199de1 to 19a79e4 Compare June 2, 2022 10:31
Comment thread npm-distribution/package.json Outdated
Comment thread DEVELOPMENT.md
2. Find the latest version (either via the releases tab on GitHub or via git tags) to determine which version you are releasing.
3. `VERSION=9.9.9 ./release.sh` (replace `9.9.9` with the version you are releasing)
4. GitHub will automatically perform the release via the [goreleaser action](https://github.com/sourcegraph/src-cli/actions?query=workflow%3AGoreleaser). Once it has finished, **you need to confirm**:
3. Update the `"version"` field in the file `npm-distribution/package.json` to match the version you are releasing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can the release script automate that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is it OK if the release step runs git push origin main? I already updated the release script to validate that the version in package.json matches but didn't feel comfortable pushing a commit to main without review/test-plan.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Given that we need to merge the changelog entries anwyays, i think it's OK to require a PR before running VERSION=X ./release.sh

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm happy to follow up on this after merge. Gonna try to cut a new release to see it go live on npm

GITHUB_TOKEN: ${{ secrets.GH_PAT }}

npm:
runs-on: ubuntu-latest

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this depend on the goreleaser step? Otherwise there will be a short moment in which it doesn’t work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. I updated the flow to depend on the goreleaser job.

Fixes #759. Previously, the recommended way to install src-cli on Linux
was to download a static binary via `curl`. This PR makes it possible to
install src-cli via `npm install -g @sourcegraph/src`. The new npm
distribution will be particuarly helpful for users of our new
scip-typescript and scip-python indexers that are also distributed via
npm.
@olafurpg olafurpg force-pushed the olafurpg/npm-distribution branch from 19a79e4 to 1e1f613 Compare June 2, 2022 10:43
@olafurpg olafurpg merged commit dd9000a into main Jun 2, 2022
@olafurpg olafurpg deleted the olafurpg/npm-distribution branch June 2, 2022 10:52
@olafurpg

olafurpg commented Jun 2, 2022

Copy link
Copy Markdown
Contributor Author

@eseliger

eseliger commented Jun 2, 2022

Copy link
Copy Markdown
Member

Woho, seems to have worked!

Re the additional manual step:
How do you feel about using a similar approach that the semanticrelease bot uses?

It has 0.0.0-dev checked in as the version and replaces it inline when the release process runs.

@olafurpg

olafurpg commented Jun 2, 2022

Copy link
Copy Markdown
Contributor Author

@eseliger That's a nice idea. I opened #763 implementing your suggestion.

scjohns pushed a commit that referenced this pull request Apr 24, 2023
* Make src-cli installable via npm.

Fixes #759. Previously, the recommended way to install src-cli on Linux
was to download a static binary via `curl`. This PR makes it possible to
install src-cli via `npm install -g @sourcegraph/src`. The new npm
distribution will be particuarly helpful for users of our new
scip-typescript and scip-python indexers that are also distributed via
npm.

* Make the npm release flow depend on goreleaser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make src-cli installable via npm

2 participants