使用变量创建 git 包

问题描述 投票:0回答:1

如何在上一个标签和最后一个标签之间的运行程序中从 ci 创建 git 包? 我需要在 ci 上创建 git 包但不起作用。 我的舞台是:

create-bundle:
  stage: bundling
  variables:
    BU_FILE_NAME: 'last.bundle'
    BU_FILE_PATH: 'D:\BU\ProjectName'
  before_script:
    - $PREVIOUS_VERSION = $(git describe --abbrev=0 --tags (git rev-list --tags --skip=1 --max-count=1))
    - $LAST_VERSION = $(git describe --abbrev=0 --tags (git rev-list --tags --max-count=1))
  script:
    - echo "Start @@@@@@@@@ create-bundle"
    - cd $BETA_PATH
    - echo $PREVIOUS_VERSION
    - echo $LAST_VERSION
    - git bundle create $BU_FILE_NAME $CI_DEFAULT_BRANCH $PREVIOUS_VERSION..$LAST_VERSION 
    - mv -Force $BU_FILE_NAME $BU_FILE_PATH
    - git status
  only:
    - Dev

这条线无法正常工作:

git bundle create $BU_FILE_NAME $CI_DEFAULT_BRANCH $PREVIOUS_VERSION..$LAST_VERSION

经过多次尝试,我找到了这项工作:

git bundle create $BU_FILE_NAME $CI_DEFAULT_BRANCH 1.1.7..$LAST_VERSION

如何解决?

git powershell continuous-integration gitlab-ci gitlab-ci-runner
1个回答
0
投票

这不是设置 shell 变量的方式!

before_script
行更改为:

    - PREVIOUS_VERSION=$(git describe --abbrev=0 --tags "$(git rev-list --tags --skip=1 --max-count=1)")
    - LAST_VERSION=$(git describe --abbrev=0 --tags "$(git rev-list --tags --max-count=1)")
© www.soinside.com 2019 - 2024. All rights reserved.