microstates / ember

@microstates/ember - Official Microstates bindings for Ember.js
https://ember-microstates.netlify.com
MIT License
70 stars 12 forks source link

Adding automated NPM publishing #205

Closed taras closed 4 years ago

taras commented 4 years ago

Motivation

We want to eliminate as much as possible any friction in consuming packages published from our repositories. This is important because when you find a bug or make an improvement, nothing feels worse than waiting for the package to be release. It also creates unnecessary dependency on the maintainers to manually publish.

Approach

I'm adding GitHub Actions that Frontside developing that we can call Transparent NPM Publishing workflow. We'll eventually write a long blog post explaining how it works, but in the mean time we can enjoy the benefits of publishing without running npm publish.

There are 3 actions in play here,

  1. publish-pr-preview - automatically publish packages from pull request
  2. syncronize-with-npm which runs on master and branches starting with release- to publish to npm whenever version in master changed
  3. synchronize-npm-tags - I need to figure out what this does

The workflows are as follows,

When you want to consume changes from a PR

  1. Create a pull request
  2. You'll get a comment with information about package that was published

When you want to release

  1. Create a pull request with change to version in package.json
  2. Once you merge, it'll automatically publish
taras commented 4 years ago

@minkimcello why is this authentication failing? https://github.com/microstates/ember/pull/205/checks?check_run_id=364552785

minkimcello commented 4 years ago

Hmm it's an error I'm seeing for the first time so it may have to do with the npmjs settings (on npmjs.com). I'll keep looking into it.

But is there a reason you're using v1.1 and not v1.2? We removed little unnecessary scraps here and there and didn't introduce completely new changes (for v1.2) aside from the variable naming convention but just because preview and release uses NPM_TOKEN doesn't mean synchronize-npm-tags needs to too.

Edit: Yeah, so there's not a whole lot going on for authentication for npmjs. It gets complicated with logging into Github but for npmjs it's just a matter of passing in the token to the npmrc file. So maybe someone changed the npmjs settings recently?

minkimcello commented 4 years ago

synchronize-npm-tags - I need to figure out what this does

synchronize-npm-tags is meant to run whenever a branch is deleted. It's a clean up process to untag (on npmjs.com) the branch names if that branch doesn't exist anymore.

knownasilya commented 4 years ago

@taras how's this coming along?

minkimcello commented 4 years ago

Ran the same action on microsates/microstates.js here. So it must be a repo setting assuming a different token wasn't generated from npmjs for microstates/ember.

I can't see repo settings so can you look over to see what's different between microstates.js and ember?

frontsidejack commented 4 years ago

A preview package of this pull request has been published with the tag add-automated-npm-publishing. You can try it out by running the following command:

$ npm install @microstates/ember@add-automated-npm-publishing

or by updating your package.json to:

{
  "@microstates/ember": "add-automated-npm-publishing"
}

Generated by :no_entry_sign: dangerJS against a519cfd4776111f1dcf3557680c2bbf380b5e62f