Skip to content

Commit

Permalink
Merge branch 'main' into GabLeRoux-patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
webbertakken authored Sep 7, 2023
2 parents 51bc0b2 + cca8a92 commit 95c86d4
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/03-github/03-test-runner.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,18 @@ This is useful if your manifest has a dependency on a private GitHub repo.

_**required:** `false`_ _**default:** ``_

#### sshPublicKeysDirectoryPath

SSH directory path to mount in the container on `~/.ssh`. Must be used with `sshAgent`.

It is recommended to have only public keys in this directory, and rely on `sshAgent` to manage
private keys.

This is useful if your manifest has a dependency on multiple private GitHub repos and you need to
use multiple SSH deploy keys.

_**required:** `false`_ _**default:** ``_

#### gitPrivateToken

GitHub Private Access Token (PAT) to pull from GitHub.
Expand Down
53 changes: 53 additions & 0 deletions docs/03-github/04-builder.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,18 @@ This is useful if your manifest has a dependency on a private GitHub repo.

_**required:** `false`_ _**default:** `""`_

#### sshPublicKeysDirectoryPath

SSH directory path to mount in the container on `~/.ssh`. Must be used with `sshAgent`.

It is recommended to have only public keys in this directory, and rely on `sshAgent` to manage
private keys.

This is useful if your manifest has a dependency on multiple private GitHub repos and you need to
use multiple SSH deploy keys.

_**required:** `false`_ _**default:** ``_

#### gitPrivateToken

Github private token to pull from github.
Expand Down Expand Up @@ -505,6 +517,47 @@ steps:
sshAgent: ${{ env.SSH_AUTH_SOCK }}
```

### Multiple private Github repositories

[GitHub Deploy Keys](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/managing-deploy-keys#deploy-keys)
are SSH keys that can only be set up on repository level. If you have multiple private repositories
in your packages/manifest.json, you will need to add a Github Deploy Key for each one, and use the
`webfactory/ssh-agent` action to manage them and use the right SSH key for each repository.

In order for `webfactory/ssh-agent` to work inside the container, you will need to upload the public
keys, SSH config and set the git url mirroring configurations in the container. You can do that by
using `sshPublicKeysDirectoryPath` and setting the `GIT_CONFIG_EXTENSIONS` environment variable:

```yaml
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: |
${{ secrets.FIRST_KEY }}
${{ secrets.NEXT_KEY }}
${{ secrets.ANOTHER_KEY }}
- name: Prepare SSH config for unity builder
run: |
mkdir $HOME/.ssh_docker
cp $HOME/.ssh/config $HOME/.ssh_docker/
cp $HOME/.ssh/key* $HOME/.ssh_docker/
cp $HOME/.ssh/known_hosts $HOME/.ssh_docker/
sed -i 's/\/home\/runner/\/root/g' $HOME/.ssh_docker/config
sudo chown -R root:root $HOME/.ssh_docker
GIT_CONFIG_EXTENSIONS=$(git config --list | grep '^url\.')
{
echo 'GIT_CONFIG_EXTENSIONS<<EOF'
echo "$GIT_CONFIG_EXTENSIONS"
echo EOF
} >> "$GITHUB_ENV"
shell: bash
- uses: game-ci/unity-builder@v3
with:
sshAgent: ${{ env.SSH_AUTH_SOCK }}
sshPublicKeysDirectoryPath: ${{ env.HOME }}/.ssh_docker
```

## UPM authentication using .upmconfig.toml

Unity requires an .upmconfig.toml to exist in the home directory to authenticate and download
Expand Down

0 comments on commit 95c86d4

Please sign in to comment.