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

How to execute 'npm script' within github action and use the script output as a package source #16

Open
kuncevic opened this issue Jul 19, 2020 · 2 comments

Comments

@kuncevic
Copy link

I have a library that I build with Angular CLI here https://github.com/kuncevic/rx-service
In order to release a new version of the library manually I had to to this steps:

  1. ng build --prod
  2. cd dist/library-name
  3. npm publish

It just can be looks like a single npm script "publish": "ng build --prod && cd dist/library-name && npm publish"

I want to release that library using github actions so the steps above needs to be executed within an action, by looking in to npm-publish-action but didn't found a way to achieve that.

Any ideas?

@pascalgn
Copy link
Owner

I think it might be enough to add this to the prepublish step (see https://docs.npmjs.com/misc/scripts) in package.json like this:

  "scripts": {
    "prepublish": "ng build --prod"
  }

Regarding the cd dist/library-name part, this is implemented in #15, I will have a look at it now!

@kuncevic
Copy link
Author

kuncevic commented Jul 29, 2020

Just tested out by following the steps:

  1. prepublish script https://github.com/kuncevic/rx-service/blob/master/package.json#L11
  2. workspace dir https://github.com/kuncevic/rx-service/blob/master/.github/workflows/npm-publish.yml#L23
  3. release commit angularconsulting/rx-service@b34eefd

In result I've got the action triggered https://github.com/kuncevic/rx-service/actions/runs/186705728 but nothing was pushed to npm ref: npm show rx-service time and https://www.npmjs.com/package/rx-service still show that 0.0.6 is the latest version

UPDATE:
Tried again with 0.0.8 but on way so just had to push the new version manually after all

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

No branches or pull requests

2 participants