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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.

NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 😁

* Lookup all commits between the git commit that triggered the action and the latest publish.
* If the package hasn't been published or the prior publish does not include a git hash, we'll
only pull the commit data that triggered the action.
Expand Down
9 changes: 7 additions & 2 deletions merge-release-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ const run = async () => {
console.log('current:', current, '/', 'version:', version)
let newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString()
console.log('new version:', newVersion)
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’

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 @


exec(`npm publish --access=${access}`)

exec(`git checkout package.json`)
exec(`git tag ${newVersion}`)
exec(`git push merge-release --tags`)
}
Expand Down