Add env for branch to use
This commit is contained in:
parent
c5cd522a22
commit
0d7b92f3d2
@ -31,6 +31,10 @@ If you specify a SSH URL (`ssh:// ...`) for your repository, the host key will b
|
|||||||
|
|
||||||
If you want to pull private repositories, you may need to generate a SSH key for this purpose, and hand in the private key file, e.g. via `-v ./id_rsa:/root/.ssh/id_rsa`.
|
If you want to pull private repositories, you may need to generate a SSH key for this purpose, and hand in the private key file, e.g. via `-v ./id_rsa:/root/.ssh/id_rsa`.
|
||||||
|
|
||||||
|
#### Specify branch
|
||||||
|
|
||||||
|
If there is a specific branch to use (other than [master/main](https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/)), you can specify the desired branch using the `REPO_BRANCH` environment variable.
|
||||||
|
|
||||||
### Passthrough via Bind
|
### Passthrough via Bind
|
||||||
|
|
||||||
To just use a specific directory as the hugo blog contents, run the container with the repository passed through as bind directory:
|
To just use a specific directory as the hugo blog contents, run the container with the repository passed through as bind directory:
|
||||||
|
@ -17,7 +17,11 @@ set -e -v
|
|||||||
# repo URL set
|
# repo URL set
|
||||||
if [ ! -d /repo ]; then
|
if [ ! -d /repo ]; then
|
||||||
# repo needs to be cloned
|
# repo needs to be cloned
|
||||||
git clone --recurse-submodules $REPO_URL /repo
|
# check if there is a specific branch to clone
|
||||||
|
if [ ! "$REPO_BRANCH" == "" ]; then
|
||||||
|
BRANCHCMD="--branch $REPO_BRANCH"
|
||||||
|
fi
|
||||||
|
git clone --recurse-submodules $BRANCHCMD $REPO_URL /repo
|
||||||
else
|
else
|
||||||
# no - pull existing repo
|
# no - pull existing repo
|
||||||
cd /repo && git pull --recurse-submodules
|
cd /repo && git pull --recurse-submodules
|
||||||
|
Loading…
Reference in New Issue
Block a user