Gitlab CI:更改项目名称

时间:2019-07-05 06:30:35

标签: gitlab-ci gitlab-ci-runner

image: python:2.7-jessie

stages:
  - build
  - build_tag

before_script:
  - mv project ${CI_PROJECT_NAME/./_}

build-after-commit:
  stage: build
  script:
    - mv build/${CI_PROJECT_NAME/./_}.zip build/${CI_PROJECT_NAME/./_}_${CI_COMMIT_TAG:-0.0.0}.zip
  except:
    - tags
  artifacts:
    expire_in: 1 day
    when: on_success
    name: ${CI_PROJECT_NAME/./_}
    paths:
      - build/*.zip

我有这个gitlab ci文件,该文件现在对我有用。但是,如您所见,我一直使用${CI_PROJECT_NAME/./_},因为我的项目名称是my.project,我需要将其更改为my_project。有更好的方法吗?还是我可以做这样的事情?

image: python:2.7-jessie
NEW_NAME: ${CI_PROJECT_NAME/./_}

stages:
  - build
  - build_tag

before_script:
  - mv project ${NEW_NAME}

build-after-commit:
  stage: build
  script:
    - mv build/${NEW_NAME}.zip build/${NEW_NAME}_${CI_COMMIT_TAG:-0.0.0}.zip
  except:
    - tags
  artifacts:
    expire_in: 1 day
    when: on_success
    name: ${NEW_NAME}
    paths:
      - build/*.zip

0 个答案:

没有答案