Skip to content

Instantly share code, notes, and snippets.

@IliasDeros
Last active September 29, 2020 14:01
Show Gist options
  • Save IliasDeros/a18eced26cf364606cd3e9300a698dd2 to your computer and use it in GitHub Desktop.
Save IliasDeros/a18eced26cf364606cd3e9300a698dd2 to your computer and use it in GitHub Desktop.
Set up a Github project to have CircleCI publish an npm patch
  1. From your local machine, generate an ssh key
ssh-keygen -m PEM -t rsa -C "email@domain.com"
  1. Add the public key to your Github project's Deploy Keys
  2. Add the private key to your CircleCI project's SSH keys (set the domain to "github.com")
  3. Copy the fingerprint from the key you just added on CircleCI
  4. Paste that fingerprint in your .circleci/config.yml under steps > add_ssh_keys > fingerprints

Source: https://circleci.com/docs/2.0/gh-bb-integration

version: 2
jobs:
deploy-job:
steps:
- add_ssh_keys:
fingerprints:
- "SO:ME:FIN:G:ER:PR:IN:T"
- run:
name: "Commit & Push npm patch"
command: |
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
git config user.email "email@domain.com"
git config user.name "Your Name"
npm version patch
git push --follow-tags
sign-git-tag=false
message="[skip ci] %s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment