mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-27 19:42:11 +10:00
Copy GitHub SSH key in Heroku to access private repositories
This commit is contained in:
parent
96b519a9de
commit
2e2ecbc0a9
2 changed files with 28 additions and 0 deletions
27
heroku-copy-ssh-key-from-env.sh
Executable file
27
heroku-copy-ssh-key-from-env.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Since we have a dependency to a private GitHub
|
||||
# `sharetribe/sharetribe-sdk-js` repository, we must give Heroku SSH
|
||||
# access to there. This script copies the GITHUB_SSH_KEY to the
|
||||
# current user to enable SSH access to the repository.
|
||||
|
||||
# NOTE: This script should be removed when the dependency is not a
|
||||
# private repository anymore.
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$GITHUB_SSH_KEY" ]
|
||||
then
|
||||
echo "No GitHub SSH key to copy"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Copying GitHub SSH key"
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
echo "$GITHUB_SSH_KEY" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
|
||||
echo "Adding GitHub SSH Host key to known hosts"
|
||||
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
|
||||
chmod 600 ~/.ssh/known_hosts
|
||||
|
|
@ -44,6 +44,7 @@
|
|||
"eject": "sharetribe-scripts eject",
|
||||
"start": "node server/index.js",
|
||||
"dev-server": "yarn run build&&nodemon --watch server server/index.js",
|
||||
"heroku-prebuild": "./heroku-copy-ssh-key-from-env.sh",
|
||||
"heroku-postbuild": "yarn run build"
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue