Enhance publish_release job: export version and add release metadata for automated releases
This commit is contained in:
parent
93413b0fe9
commit
3ae4da3e49
1 changed files with 11 additions and 5 deletions
|
|
@ -120,6 +120,7 @@ publish_release:
|
||||||
version=$(minver 2>/dev/null | tail -n1 || true)
|
version=$(minver 2>/dev/null | tail -n1 || true)
|
||||||
if [ -z "$version" ]; then echo "minver failed to produce a version"; exit 1; fi
|
if [ -z "$version" ]; then echo "minver failed to produce a version"; exit 1; fi
|
||||||
echo "Using version: $version"
|
echo "Using version: $version"
|
||||||
|
export VERSION="$version"
|
||||||
# find the single-file exe from the publish output
|
# find the single-file exe from the publish output
|
||||||
file=$(find imagecatalog/bin -type f -iname '*.exe' -print | head -n1 || true)
|
file=$(find imagecatalog/bin -type f -iname '*.exe' -print | head -n1 || true)
|
||||||
if [ -z "$file" ]; then file=$(find imagecatalog -type f -iname '*.exe' -print | head -n1 || true); fi
|
if [ -z "$file" ]; then file=$(find imagecatalog -type f -iname '*.exe' -print | head -n1 || true); fi
|
||||||
|
|
@ -131,13 +132,18 @@ publish_release:
|
||||||
assetUrl="$CI_SERVER_URL$assetPath"
|
assetUrl="$CI_SERVER_URL$assetPath"
|
||||||
echo "Uploaded asset url: $assetUrl"
|
echo "Uploaded asset url: $assetUrl"
|
||||||
basename=$(basename "$file")
|
basename=$(basename "$file")
|
||||||
cat > release.json <<EOF
|
export RELEASE_ASSET_URL="$assetUrl"
|
||||||
{"name":"$version","tag_name":"$version","ref":"$CI_COMMIT_SHA","description":"Automated release from CI (version $version)","assets":{"links":[{"name":"$basename","url":"$assetUrl"}]}}
|
export ASSET_BASENAME="$basename"
|
||||||
EOF
|
|
||||||
echo "Creating release for tag: $version"
|
|
||||||
curl --silent --show-error --header "JOB-TOKEN:$CI_JOB_TOKEN" -X POST -H "Content-Type: application/json" --data @release.json "$CI_API_V4_URL/projects/$CI_PROJECT_ID/releases"
|
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 day
|
expire_in: 1 day
|
||||||
|
release:
|
||||||
|
tag_name: "$VERSION"
|
||||||
|
name: "Release $VERSION"
|
||||||
|
description: "Automated release from CI (version $VERSION)"
|
||||||
|
assets:
|
||||||
|
links:
|
||||||
|
- name: "$ASSET_BASENAME"
|
||||||
|
url: "$RELEASE_ASSET_URL"
|
||||||
# only:
|
# only:
|
||||||
# - tags
|
# - tags
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue