-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: package workflow now adds the package as asset
- Loading branch information
Showing
2 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> | ||
# Author: Sergio Martins <sergio.martins@kdab.com> | ||
# SPDX-License-Identifier: MIT | ||
|
||
# Uploads the qttests-<version>.vsix package to GitHub Release | ||
# Called by .github/workflows/package.yml | ||
|
||
# Get latest tag: | ||
TAG_NAME=`git describe --tags --abbrev=0` | ||
|
||
# Drop the 'v' prefix: | ||
VERSION=${TAG_NAME:1} | ||
|
||
PACKAGE_FILENAME=qttests-$VERSION.vsix | ||
|
||
if [ ! -f $PACKAGE_FILENAME ]; then | ||
# Doesn't happen. Package is created by package.yml | ||
echo "Package $PACKAGE_FILENAME does not exist" | ||
exit 1 | ||
fi | ||
|
||
# Check if release exists: | ||
gh release view $TAG_NAME &> /dev/null | ||
if [ $? -ne 0 ]; then | ||
# Should not happen, as releases are created by release-please | ||
echo "Release $TAG_NAME does not exist" | ||
exit 1 | ||
fi | ||
|
||
# Check if release already contains the asset: | ||
gh release view $TAG_NAME --json assets | jq -r '.assets[].name' | grep -q $PACKAGE_FILENAME | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "Asset $PACKAGE_FILENAME already exists in release $TAG_NAME" | ||
exit 0 | ||
fi | ||
|
||
gh release upload $TAG_NAME $PACKAGE_FILENAME |