Like many developers out there, we work on side projects from time to time. Sometimes it's to learn, to have fun or to make money. Regardless of the reason, we often throw in the towel due to burnout, loss of interest or that frustrating service/tool that should just work™ but doesn't.
I recently murmured "Why isn't this just working as stated!" while attempting to get Heroku to install my private Github packages. I headed to my trusty ol' friend, Google, to scour the internet for an answer only to be repeatedly told that I need to 'commit an .npmrc file' with the registry URL (with auth token) and getting absolutely nowhere.
On the verge of giving up, I decided to head into the Github actions source code. After all I was able to publish my package to my private Github registry in a CI environment.
Below is the code that dynamically creates the
.nmprc file before the Heroku build (using the
heroku-prebuild hook), using values from the environment variables.
auth-npm.jsscript to your project (I add it to my
Drop a comment below if you're running into trouble and/or if you have improvements!
Remember to #KeepHavingFun
You're one click away
Level up every day