KMMBridgegithubDeploy Key Manual Setup

Deploy Key Manual Setup

Create Deploy Keys

You’ll need a deploy key to give your GitHub Actions CI access to an external repo. To set up a deploy key, create an ssh public/private key pair on your local machine using the following command

ssh-keygen -t ed25519 -f deploykey -C "git@github.com:<ORG>/<PODSPEC REPO>"

  • -f deploykey gives a custom name deploykey to the generated keys and will put both keys in the current directory. If you run this command in your repo make sure you delete these files after finishing setup and do NOT commit them to your repo.

  • -C "git@github.com:<ORG>/<PODSPEC REPO>" adds the target repo as a comment to the key that gives the ssh client a hint on when to use this key. This is optional but recommended.

Generally the comment in the key is not important, but in this case, the workflow configures access to a specific repo based on the comment. If you have failures like ERROR: Repository not found. or fatal: Could not read from remote repository., make sure you used the target repo and not the build repo in your comment.

After running this command, your working directory will have two files: deploykey, the private key, and deploykey.pub, the public key. The public key, deploykey.pub, is what you will set up as a deploy key in your target repo. The private key, deploykey, will need to be added in the ssh agent in your CI actions in order to pull/push from the target repo.

Add Deploy Key to target Repo

To add deploykey.pub to your target repo, go to Settings->Deploy Keys (you’ll need admin access to the repo), then click Add Deploy Key

Deploy Keys

Give your deploy key a useful title like KMMBridge Publish Key, then copy the contents of deploykey.pub into the Key field. Select Allow write access, then click Add key and your deploy key will be setup.

img.png

Add Deploy Key to KMP Repo

Once you have the public key of your deploy key pair, you’ll need to have the private key available in order to publish from CI.

In the repo for the KMP code you want to publish, go to Settings -> Secrets -> Actions (you’ll need repo admin).

img_1.png

Click Add Secret and name your secret KMMBRIDGE_SSH_KEY. You can give it any name you’d prefer, but any samples we use that publish to an external repo use this name.

Paste the entire contents of deploykey into the Secrets field then click Add Secret

img.png