Small and simple Docker image to create and push a tag into a git repository
You need to run the docker image with the following environment variables set:
GIT_USER_NAME
Name of the user who will create the tag. Required for git configuration.- Eg.
Gitlab CI
- Eg.
GIT_USER_EMAIL
Email of the user who will create the tag. Required for git configuration.- Eg.
git@example.com
- Eg.
GIT_REPO
Git SSH URL repository of which you want to push the tag.- Eg.
git@github.com:manoamaro/git-tagger.git
- Eg.
GIT_PRIVATE_KEY
Private key of git repository account encoded in base64. This account needs to have write access to the repository.- How to generate:
cat ~/.ssh/id_rsa | openssl base64 | tr -d '\n'
- How to generate:
GIT_HOST
The host of the git repository, for ssh known hosts reasons.- Eg.
github.com
- Eg.
GIT_REF
The branch name where the tag should be created.- Eg.
develop
- Eg.
TAG_NAME
The new tag name.- Eg.
release_1.0
- Eg.
- Using Gitlab CI predefined variables
CI_COMMIT_REF_NAME
GITLAB_USER_NAME
GITLAB_USER_EMAIL
- Using defined variables in CI
GIT_REPO
TAG_NAME
GIT_PRIVATE_KEY
docker run --rm \
-e GIT_USER_NAME="$GITLAB_USER_NAME" \
-e GIT_USER_EMAIL="$GITLAB_USER_EMAIL" \
-e GIT_REPO="$GIT_REPO" \
-e GIT_PRIVATE_KEY="$GIT_PRIVATE_KEY" \
-e GIT_HOST="gitlab.com" \
-e GIT_REF="$CI_COMMIT_REF_NAME" \
-e TAG_NAME="$TAG_NAME"\
manoamaro/git-tagger:latest