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

add github actions to publish package to npm & gpr #9

Merged
merged 7 commits into from
Feb 24, 2023
Merged

add github actions to publish package to npm & gpr #9

merged 7 commits into from
Feb 24, 2023

Conversation

o-az
Copy link
Contributor

@o-az o-az commented Feb 21, 2023

Action only runs when a tag is pushed && branch is main.

Action has 4 jobs:

  • build and cache dist folder,
  • grab cached dist and publish to npm registry,
  • grab cached dist and publish to GitHub Package Registry,
  • run https://github.com/antfu/changelogithub to generate GitHub release changelog.

So release process becomes yarn release which will trigger release script from package.json then prompt you to select new version (see example). Once version is selected, the version in package.json gets updated, git tags created and pushed. New tags being pushed will trigger CI.

CleanShot 2023-02-20 at 21 57 36

Also the above has to be done while in main otherwise CI won't run. So on code updates you would push those updates to whatever branch, merge to main, then run yarn release.

@o-az
Copy link
Contributor Author

o-az commented Feb 21, 2023

@tjayrush

another thing is for org packages on npm and gpr, the package name tends to be @org_name/<pkg_name> so in TrueBlocks' case, @trueblocks/sdk would be what I immediately think if if I wanted to install your sdk and didn't know the name. NPM allows orgs to have the @org_name prefix.

Example:
image

https://docs.npmjs.com/creating-and-publishing-an-organization-scoped-package

I haven't included this part in this PR but I can in another one.

@tjayrush
Copy link
Member

@tjayrush

another thing is for org packages on npm and gpr, the package name tends to be @org_name/<pkg_name> so in TrueBlocks' case, @trueblocks/sdk would be what I immediately think if if I wanted to install your sdk and didn't know the name. NPM allows orgs to have the @org_name prefix.

Example: image

https://docs.npmjs.com/creating-and-publishing-an-organization-scoped-package

I haven't included this part in this PR but I can in another one.

If I understand this properly, you're saying "most" packages would be called trueblocks/sdk, but this one isn't, but that it's easy to add.

If that's correct, let's go a head and make that change now.

If that's not correct, can you please further explain?

@o-az
Copy link
Contributor Author

o-az commented Feb 21, 2023

@tjayrush yup, your understanding is correct. So I will add the change to this repo.

@o-az
Copy link
Contributor Author

o-az commented Feb 21, 2023

@tjayrush done. Package renamed to @trueblocks/sdk. The @org piece is not optional - it's reserved to org accounts so that's why it's used here.

@tjayrush
Copy link
Member

I merged your first PR. Thanks for that. I think it caused a few conflicts. Can you please correct them? I'll merge this one when you do. Sorry if I did something wrong.

@tjayrush
Copy link
Member

This is excellent. Thanks so much.

@tjayrush tjayrush merged commit d546da6 into TrueBlocks:main Feb 24, 2023
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.

2 participants