https://pulumi.com logo
Title
w

white-rainbow-68240

07/13/2020, 1:08 PM
Anyone who knows how I can install private npm packages via github actions? I'm using a github ssh link
"foo-abc": "<git+ssh://git>@github.com/my-co/foo-abc.git#v1.0.1"
The relevant yaml for my github workflow looks like this:
- name: setup ssh
        env:
          SSH_AUTH_SOCK: /tmp/ssh_agent.sock
        run: |
          mkdir -p ~/.ssh
          ssh-keyscan <http://github.com|github.com> >> ~/.ssh/known_hosts
          ssh-agent -a $SSH_AUTH_SOCK > /dev/null
          ssh-add - <<< "${{ secrets.GH_PRIVATE_SSH }}"
      - name: npm install
        env:
          SSH_AUTH_SOCK: /tmp/ssh_agent.sock
        run: npm install
m

millions-furniture-75402

07/13/2020, 1:19 PM
I believe you need to generate a Personal Access Token with package read scope, and configure
.npmrc
and your
package.json
. https://blog.bitsrc.io/install-npm-private-packages-in-ci-cd-with-github-actions-746db95017cc
w

white-rainbow-68240

07/13/2020, 7:43 PM
We won't publish to npm, but install via git ssh links. Thanks though ❤️
m

millions-furniture-75402

07/13/2020, 7:48 PM
GitHub has a private package repository. You would be publishing your package to a private repository that another one of your private repositories could read from with the proper Personal Access Token scope
@white-rainbow-68240 have you considered this approach for your use case?
w

white-rainbow-68240

07/14/2020, 1:06 PM
I will look into it. For now, I had the chance to open source the repo, so ended up publishing to npm as an open repo. If we need a private repo, I'd probably go with npm since alpine images don't have git installed. It just works better out-of-the-box with npm.
It's not really a hard problem, but most infra issues just take so much time to solve when you have 5 different services that all need to be integrated correctly.
m

millions-furniture-75402

07/14/2020, 1:29 PM
I’m confused if you mean you’re going to publish your package publicly on npmjs.com — github also offers a private registry that you can use with the npm client https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-npm-for-use-with-github-packages
w

white-rainbow-68240

07/14/2020, 4:00 PM
That looks really interesting! I'll give it a chance as soon as we need to do something private.
Just having something a bit more integrated with github actions would make it all simpler
m

millions-furniture-75402

07/14/2020, 5:07 PM
Yeah, using the github packages feature is that. Definitely worth looking into.