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

Support for Private/Restricted Repos and Packages #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Jonjoe
Copy link

@Jonjoe Jonjoe commented Nov 22, 2019

Hi!

Loving this repo so thank you for creating it.

Currently this will always push public releases which unfortunately means it cannot be used for private/restricted packages. I've written in some simple support for private/restricted packages by checking against an EnvVar and assigning the access level in the NPM public command.

Its untested as im not actually sure how to develop/test GitHub Actions. However, the logic is super simple so i'm hoping this will be easy to resolve!

I have also added the new EnvVar in the example yml file.

Please let me know if ive missed anything I will be happy to add it in.

Thanks again :)

@Jonjoe Jonjoe changed the title Support for Private/Restricted Repos and packages Support for Private/Restricted Repos and Packages Nov 22, 2019
Copy link
Owner

@mikeal mikeal left a comment

Choose a reason for hiding this comment

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

Love it! A few adjustments but I definitely want to get this in.

exec(`npm publish --access=public`)
exec(`git checkout package.json`) // cleanup

let access = ''
Copy link
Owner

Choose a reason for hiding this comment

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

This can be more easily written as const access = process.env.NPM_PRIVATE ? ‘restricted’ : ‘public’

@@ -30,4 +30,5 @@ jobs:
uses: mikeal/merge-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_PRIVATE: false
Copy link
Owner

Choose a reason for hiding this comment

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

Let’s leave this out so that we’re testing the default behavior in our own publishes.

@@ -9,6 +9,7 @@ you'll need to configured that workflow yourself. You can look to the
### Workflow

* Check for the latest version number published to npm.
* If you wish privately publish your package please ensure you have set `NPM_PRIVATE` to `true`
Copy link
Owner

Choose a reason for hiding this comment

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

Go ahead and just add another section at the bottom for features and write up this feature along with an example. This is a great feature and I want to make sure people see the work you’ve done 😁

@mikeal
Copy link
Owner

mikeal commented Nov 22, 2019

Its untested as im not actually sure how to develop/test GitHub Actions. However, the logic is super simple so i'm hoping this will be easy to resolve!

Ya, I haven’t found a sufficient way to test changes in this library so there’s no expectation that contributions need to include them. I’ve just been augmenting the lack of available testing by spending more time on reviews.

@Jonjoe
Copy link
Author

Jonjoe commented Dec 1, 2019

Thanks, man, apologies, I haven't had a chance to sort these changes. Will do them asap.

@mikeal
Copy link
Owner

mikeal commented Dec 2, 2019

No worries, there’s no pressure on my end since I don’t need this feature yet 😉

joscha added a commit to joscha/merge-release that referenced this pull request Jan 17, 2020
We just got badly burnt by the current behaviour of this plugin.

Scoped packages, e.g. `@org/package` are restricted by default, e.g. an `npm publish` publishes them privately whilst the default behaviour of npm for a unscoped package is to publish it publicly; e.g. `package` will be release `public` with a simple `npm publish`.
This plugin diverts from the default npm behaviour in that it releases all packages, independent of their configuration or the sane npm default, publicly.

references mikeal#8 

cc @joshua-leyshon-canva
exec(`git checkout package.json`) // cleanup

let access = ''
process.env.NPM_PRIVATE ? access = 'restricted' : 'public'

Choose a reason for hiding this comment

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

Tt @

@alvarolorentedev
Copy link

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.

4 participants