Created upload stage and job to run before release and upload to package
registry Release job now links to the package registry
This commit is contained in:
58
kibot-ci.yml
58
kibot-ci.yml
@@ -10,10 +10,12 @@ variables:
|
||||
GIT_SUBMODULE_STRATEGY: normal
|
||||
GIT_SUBMODULE_FORCE_HTTPS: "true"
|
||||
# GIT_SUBMODULE_UPDATE_FLAGS: --remote --merge
|
||||
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/kicad/"
|
||||
|
||||
stages:
|
||||
- gen_mech
|
||||
- gen_fab
|
||||
- upload
|
||||
- release
|
||||
|
||||
image:
|
||||
@@ -202,10 +204,9 @@ outputs_all:
|
||||
- !reference [.commands, neo]
|
||||
- !reference [.commands, merge_libs]
|
||||
|
||||
|
||||
release_job:
|
||||
stage: release
|
||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||
upload_job:
|
||||
stage: upload
|
||||
image: curlimages/curl:latest
|
||||
needs:
|
||||
- job: outputs_all
|
||||
artifacts: true
|
||||
@@ -213,19 +214,48 @@ release_job:
|
||||
- if: $CI_COMMIT_TAG
|
||||
when: never # Do not run this job when a tag is created manually
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch
|
||||
variables:
|
||||
FAB_COMM: "curl --header \"JOB-TOKEN: ${CI_JOB_TOKEN}\" --upload-file Fabrication/$d ${PACKAGE_REGISTRY_URL}/$d"
|
||||
script:
|
||||
- echo "running release_job for $TAG"
|
||||
- |
|
||||
for f in $(find Fabrication/ \! -type d)
|
||||
do
|
||||
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file $f ${PACKAGE_REGISTRY_URL}/$(filename $f)
|
||||
done
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- Fabrication/**/*
|
||||
expire_in: 1 week
|
||||
|
||||
|
||||
release_job:
|
||||
stage: release
|
||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||
needs:
|
||||
- job: upload_job
|
||||
artifacts: true
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
when: never # Do not run this job when a tag is created manually
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch
|
||||
variables:
|
||||
FAB_COMM: "echo \"--assets-link \"{\"name\":\"$d\",\"url\":\"${PACKAGE_REGISTRY_URL}/$CI_COMMIT_MESSAGE/$d\"}\" \\\""
|
||||
script:
|
||||
- |
|
||||
echo "running release_job for $CI_COMMIT_MESSAGE"
|
||||
echo "#!/bin/bash" >> fab.sh
|
||||
echo "release-cli create --name \"Release $CI_COMMIT_MESSAGE\" --tag-name $CI_COMMIT_MESSAGE \\" >> fab.sh
|
||||
echo "--assets-link \"{\"name\":\"All\",\"url\":\"${PACKAGE_REGISTRY_URL}/$CI_COMMIT_MESSAGE\"}\" \\" >> fab.sh
|
||||
for d in $(ls -d */)
|
||||
do
|
||||
echo "--assets-link \"{\"name\":\"$d\",\"url\":\"${PACKAGE_REGISTRY_URL}/$CI_COMMIT_MESSAGE/$d\"}\" \\" >> fab.sh
|
||||
done
|
||||
chmod u+x fab.sh
|
||||
./fab.sh
|
||||
artifacts:
|
||||
when: always
|
||||
name: "$CI_PROJECT_TITLE-$CI_COMMIT_MESSAGE"
|
||||
paths:
|
||||
- Fabrication/**/*
|
||||
expire_in: never
|
||||
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
|
||||
tag_name: '$CI_COMMIT_MESSAGE' # The version is incremented per pipeline.
|
||||
description: '$CI_COMMIT_MESSAGE'
|
||||
ref: '$CI_COMMIT_SHA' # The tag is created from the pipeline SHA.
|
||||
assets:
|
||||
links:
|
||||
- name: All Fab
|
||||
url: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/download"
|
||||
expire_in: 1 week
|
||||
|
||||
Reference in New Issue
Block a user