Skip to content

Commit

Permalink
add automatic tag creation
Browse files Browse the repository at this point in the history
  • Loading branch information
seppzer0 committed May 8, 2024
1 parent ca4bebc commit b41d681
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
stages:
- tag

variables:
GIT_STRATEGY: "clone"

job-tag:
stage: tag
script:
- USERNAME="$CUSTOM_CI_USERNAME"
- PASSWORD="$CUSTOM_CI_PASSWORD"
- EMAIL="$CUSTOM_CI_EMAIL"
- TAGNAME="v$(sh scripts/get_version.sh)"
- git config --global user.name "${USERNAME}"
- git config --global user.email "${EMAIL}"
- git remote remove origin
- git remote add origin https://${USERNAME}:${PASSWORD}@gitlab.com/${CI_PROJECT_PATH}
- if [ $(git tag | grep "$TAGNAME") ]; then echo "[ * ] Tag already exists, skipping.."; else git tag $TAGNAME && git push origin $TAGNAME; fi
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- when: manual
6 changes: 6 additions & 0 deletions scripts/get_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
#
# This is an SH version of get_version.py, usually used for cases when Python interpreter is unavailable.
#

cat $(dirname $(realpath "$0"))/../package.json | grep '"version": "' | cut -d'"' -f 4

0 comments on commit b41d681

Please sign in to comment.