我正在使用 gitlab ci 构建一个 antora ui 包(有效)并将构建的 zip 文件上传到 gitlabs 包注册表。这种工作也是如此。但我总是为每个构建的作业执行获得一个新条目。请参阅https://gitlab.com/docs-central/antora-ui-bundle/-/packages/1771084 ...我希望的结果是在包注册表中只有一个工件(因此版本为“最新”)并在每次成功执行作业时覆盖此文件。
因为我喜欢将这个最新版本用于我的 antora 配置,所以我需要 URL 始终保持不变。我只想用我最新的构建结果替换这个 URL 后面的工件。
我的 .gitlab-ci.yml 文件:
image: node:10.14.2-stretch
stages:
- setup
- verify
- build
- deploy
variables:
PACKAGENAME: 'antora-ui-bundle'
VERSION: 'LATEST'
install:
stage: setup
cache:
paths:
- .cache/npm
script:
- &npm_install
npm install --quiet --no-progress --cache=.cache/npm
lint:
stage: verify
cache: &pull_cache
policy: pull
paths:
- .cache/npm
script:
- *npm_install
- node_modules/.bin/gulp lint
bundle-stable:
stage: build
only:
- master@docs-central/antora-ui-bundle
cache: *pull_cache
script:
- *npm_install
- node_modules/.bin/gulp bundle
artifacts:
paths:
- target/build/ui-bundle.zip
bundle-dev:
stage: build
except:
- master
cache: *pull_cache
script:
- *npm_install
- node_modules/.bin/gulp bundle
artifacts:
expire_in: 1 day # unless marked as keep from job page
paths:
- target/build/ui-bundle.zip
upload-to-package-registry:
stage: deploy
script:
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file target/build/ui-bundle.zip ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGENAME}/${VERSION}/${PACKAGENAME}-${VERSION}.zip'
有人知道我如何实现这一目标吗?谢谢和最好的问候。塞巴斯蒂安