소스 검색

CI: Don't rely on CIRCLE_TAG variable

It doesn't seem to be set as expected.
Danilo Bargen 6 년 전
부모
커밋
39909e1af0
1개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 5 4
      .circleci/config.yml

+ 5 - 4
.circleci/config.yml

@@ -85,9 +85,10 @@ jobs:
       - checkout
       - setup_remote_docker
       - run: >
-          export minortag=$(echo $CIRCLE_TAG | sed 's/^\(v[0-9]*\.[0-9]*\)\..*$/\1/')
-                 majortag=$(echo $CIRCLE_TAG | sed 's/^\(v[0-9]*\)\..*$/\1/')
-          docker build .  --no-cache -t $IMAGE:$CIRCLE_TAG -t $IMAGE:$minortag -t $IMAGE:$majortag
+          export tag=$(git describe --tags --abbrev=0)
+                 minortag=$(echo $tag | sed 's/^\(v[0-9]*\.[0-9]*\)\..*$/\1/')
+                 majortag=$(echo $tag | sed 's/^\(v[0-9]*\)\..*$/\1/')
+          docker build .  --no-cache -t $IMAGE:$tag -t $IMAGE:$minortag -t $IMAGE:$majortag
           && docker login -u $DOCKER_USER -p $DOCKER_API_KEY
           && docker push $IMAGE
   docker-rebuild-images:
@@ -120,7 +121,7 @@ workflows:
       - docker-push-tag:
           filters:
             tags:
-              only: /v.*/
+              only: /^v.*/
   rebuild-images:
     triggers:
       - schedule: