Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

On tag publish with GitHub Actions (GitHub Release + NPM) #334

Merged
merged 5 commits into from
Mar 12, 2021

Conversation

dennisameling
Copy link
Contributor

@dennisameling dennisameling commented Nov 19, 2020

Closes #320

✔️ on tag, upload all prebuilds to GitHub
✔️ on tag, and after successful build + prebuild upload, publish version on NPM

The only thing you have to do is to go to the repo settings > Secrets > create a secret called "NPM_AUTH_TOKEN" with a token that you got from https://www.npmjs.com/. The GITHUB_TOKEN is created automatically by GitHub Actions.

You can see it in action at https://github.com/dennisameling/node-keytar/actions/runs/373034035.

GH Release example: https://github.com/dennisameling/node-keytar/releases/tag/v7.2.5-beta
NPM example: https://www.npmjs.com/package/@dennisameling/keytar-temp

When this PR is merged, all you have to do is update the version in package.json, then git tag v7.x.x && git push v7.x.x, then the pipeline will trigger.

I added npm-publish as a separate step that depends on the build job, to be sure that all prebuilds have been built and uploaded successfully on all OSes prior to publishing to NPM. This only adds a small overhead which I think is reasonable.

Copy link
Contributor

@shiftkey shiftkey left a comment

Choose a reason for hiding this comment

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

Thanks for contributing this @dennisameling!

There's at least one blocker on merging and using this, which is why I've had to Request changes to ensure we don't land this before it'll properly work.

.github/workflows/ci.yml Outdated Show resolved Hide resolved
- name: Upload to NPM
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't currently have access to add additional settings for this repository, so I can't merge this as-is

Copy link
Contributor

Choose a reason for hiding this comment

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

Who can set it or grant you access?

@dennisameling
Copy link
Contributor Author

dennisameling commented Dec 18, 2020

@shiftkey I just updated the PR so that it only needs libsecret-1-dev in the NPM publish job, as per your suggestion. Can confirm it works.

Release: https://github.com/dennisameling/node-keytar/releases
GH Actions run: https://github.com/dennisameling/node-keytar/actions/runs/430631719
NPM: https://www.npmjs.com/package/@dennisameling/keytar-temp

As soon as you have enough permissions to add the NPM secret to the repo, this PR should be good to go 👍🏼 have a great weekend!

@orgads
Copy link
Contributor

orgads commented Feb 16, 2021

Need to rebase, as .travis.yml has been changed.

@dennisameling
Copy link
Contributor Author

Rebased 👍🏼

@shiftkey
Copy link
Contributor

Thanks for the contribution @dennisameling! I plan to do a test release tomorrow to confirm this is all working as expected, before I look at landing some of the newer PRs here...

@shiftkey shiftkey merged commit 6f5ea31 into atom:master Mar 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

migrate to GitHub Actions for building and publishing releases
3 participants