Debian Codegraph @

docs/dev/github-gitlab-migration/release

raw
1 #!/bin/sh -e
2
3 set -x
4
5 printf "Enter tag name: "
6 read tag
7 printf "Enter repository authentication token: "
8 read token
9
10 git tag -d "${tag}" || :
11
12 git tag "${tag}" -m "Release ${tag}"
13 git push origin "${tag}"
14
15 echo 'foo' > foo
16 echo 'foo signature' > foo.asc
17
18 archivename="foo"
19
20 project="poljakowski%2Fmy-cdist-testing"
21 sed_cmd='s/^.*"markdown":"\([^"]*\)".*$/\1/'
22
23 # upload archive
24 response_archive=$(curl -f -X POST \
25 -H "PRIVATE-TOKEN: ${token}" \
26 -F "file=@${archivename}" \
27 "https://code.ungleich.ch/api/v4/projects/${project}/uploads" \
28 | sed "${sed_cmd}") || exit 1
29
30 # upload archive signature
31 response_archive_sig=$(curl -f -X POST \
32 -H "PRIVATE-TOKEN: ${token}" \
33 -F "file=@${archivename}.asc" \
34 "https://code.ungleich.ch/api/v4/projects/${project}/uploads" \
35 | sed "${sed_cmd}") || exit 1
36
37 # make release
38 curl -f -X POST \
39 -H "PRIVATE-TOKEN: ${token}" \
40 -F "description=Release ${tag}<br/>${response_archive}<br/>${response_archive_sig}" \
41 "https://code.ungleich.ch/api/v4/projects/${project}/repository/tags/${tag}/release" \
42 || exit 1
43
44 # get tag
45 curl -f -X GET \
46 -H "PRIVATE-TOKEN: ${token}" \
47 "https://code.ungleich.ch/api/v4/projects/${project}/repository/tags/${tag}" \
48 || exit 1
49
50 rm -f foo foo.asc