You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
50 lines
1.3 KiB
#!/bin/sh -e
|
|
|
|
set -x
|
|
|
|
printf "Enter tag name: "
|
|
read tag
|
|
printf "Enter repository authentication token: "
|
|
read token
|
|
|
|
git tag -d "${tag}" || :
|
|
|
|
git tag "${tag}" -m "Release ${tag}"
|
|
git push origin "${tag}"
|
|
|
|
echo 'foo' > foo
|
|
echo 'foo signature' > foo.asc
|
|
|
|
archivename="foo"
|
|
|
|
project="poljakowski%2Fmy-cdist-testing"
|
|
sed_cmd='s/^.*"markdown":"\([^"]*\)".*$/\1/'
|
|
|
|
# upload archive
|
|
response_archive=$(curl -f -X POST \
|
|
-H "PRIVATE-TOKEN: ${token}" \
|
|
-F "file=@${archivename}" \
|
|
"https://code.ungleich.ch/api/v4/projects/${project}/uploads" \
|
|
| sed "${sed_cmd}") || exit 1
|
|
|
|
# upload archive signature
|
|
response_archive_sig=$(curl -f -X POST \
|
|
-H "PRIVATE-TOKEN: ${token}" \
|
|
-F "file=@${archivename}.asc" \
|
|
"https://code.ungleich.ch/api/v4/projects/${project}/uploads" \
|
|
| sed "${sed_cmd}") || exit 1
|
|
|
|
# make release
|
|
curl -f -X POST \
|
|
-H "PRIVATE-TOKEN: ${token}" \
|
|
-F "description=Release ${tag}<br/>${response_archive}<br/>${response_archive_sig}" \
|
|
"https://code.ungleich.ch/api/v4/projects/${project}/repository/tags/${tag}/release" \
|
|
|| exit 1
|
|
|
|
# get tag
|
|
curl -f -X GET \
|
|
-H "PRIVATE-TOKEN: ${token}" \
|
|
"https://code.ungleich.ch/api/v4/projects/${project}/repository/tags/${tag}" \
|
|
|| exit 1
|
|
|
|
rm -f foo foo.asc
|
|
|