Skip to content

Commit

Permalink
feat: tag bash
Browse files Browse the repository at this point in the history
  • Loading branch information
pnoker committed Jun 21, 2022
1 parent 8858292 commit ab27a29
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions dc3/git/tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

#
# Copyright (c) 2022. Pnoker. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set -e

cd ../../

type=""

if `git status | grep "develop" &>/dev/null`; then
type="develop"
fi
if `git status | grep "release" &>/dev/null`; then
type="release"
fi
if [[ ${type} == "" ]]; then
echo -e "This branch doesn't support tagging, please switch to the \033[31mdevelop\033[0m or \033[31mrelease\033[0m branch."
exit
fi


git pull --tags
# shellcheck disable=SC2046
# shellcheck disable=SC2116
tag=$(echo dc3.${type}.$(date +'%Y%m%d').$(git tag -l "dc3.${type}.$(date +'%Y%m%d').*" | wc -l | xargs printf '%02d'))
echo "${tag}"
git tag "${tag}"

git push origin --tags

0 comments on commit ab27a29

Please sign in to comment.