CI: Add a scripted release process

merge-requests/91/head
Olaf Meeuwissen 2019-07-30 22:40:11 +09:00
rodzic a8d4d4b778
commit 7799a072b4
3 zmienionych plików z 109 dodań i 65 usunięć

Wyświetl plik

@ -12,6 +12,7 @@ stages:
- prepare
- compile
- archive
- release
prepare:
image: $REGISTRY_HUB:debian-stretch-mini
@ -108,3 +109,17 @@ archive:
- sane-backends-*.tar.gz
- lists
- doc/sanei-html
release:
image: alpine
stage: release
before_script:
- apk --no-cache add curl git jq
script:
- ./tools/create-release.sh
only:
- tags
when: manual
variables:
GIT_DEPTH: "3"
allow_failure: false

Wyświetl plik

@ -1,4 +1,4 @@
2009-05-05
2019-07-30
This text summarizes some points to pay attention to when a new release
of sane-backends is planned.
@ -6,6 +6,7 @@ of sane-backends is planned.
Timetable (approximate periods):
Day 0: Announcement of upcoming release on sane-devel including timetable
and pointer to the GitLab milestone
Day 14: Feature freeze (only bugfixes + documentation updates)
Day 28: Code freeze (only fixes for bugs that can destroy hardware, can cause
compilation problems or render a backend completely unusable, and
@ -16,82 +17,49 @@ Before the release:
* set :new :yes on any new backend .desc files, by looking for added files:
cd backend
ls | while read aa; do git log --follow --diff-filter=A --find-renames=40% --format="%ai $aa" "$aa"; done > foo.log
version=1.0.27
git ls-files -- backend | while read f; do
git log --follow --diff-filter=A --find-renames=40% \
--format="%ai $f" $version..HEAD -- "$f"
done | cat
Then inspect foo.log for any files added since the last release.
* configure.ac: remove 'git' from textual version number, and increment it
* run ./autogen.sh
* Make sure that upstream files are up-to-date by running:
./tools/update-upstream.sh
Requires curl or wget.
* ChangeLog: generate from git log, something like:
git log RELEASE_1_0_25..HEAD > ChangeLog
* NEWS: update and enter date of release, etc
Get list of heavily change backends via: git diff --stat RELEASE_1_0_25
Get other things by reading ChangeLog
* sane-backends.lsm: update
Get list of heavily change backends via: git diff --stat $version..HEAD
Get list of details from: git log $version..HEAD
* git commit -a
* tag git with release tag; e.g.: 'git tag -a RELEASE_1_0_15'
* probably DONT want to git push here, because alioth will rebuild it's local
checkout needlessly
* git push origin master
Making the release:
* make tar.gz, sane-backends-x.y.z.lsm, and .md5sum with "make sane-backends"
* unpack tar.gz in temporary directory
* make diff from last release by unpacking it also in temporary directory
and running e.g.
diff -uNr sane-backends-1.0.23 sane-backends-1.0.24 > sane-backends-1.0.23-1.0.24.diff
* check that the diff applies cleanly to the old version
* gzip the diff
* install devel headers required to build optional backends (1284,gphoto,etc)
* check that the new version .tar.gz can be compiled
* upload the .tar.gz, tar.gz.md5 and .diff.gz to the FTP/HTTP servers
(at the moment: alioth.debian.org, ftp files are in
/srv/alioth.debian.org/chroot/ftproot/pub/sane/ )
In the alioth web interface, you should upload the smallest file first,
since you don't get error messages until after an upload completes,
and you might need to change something.
You can add the larger files afterwards. You may have to split larger
files.
* temporarily set a PRIVATE_TOKEN variable in the GitLab CI/CD
variables You have to create one in your own Settings > Access
Tokens. Set it to expire in a few hours to avoid abuse.
* git tag -a -s 1.0.28 -m Release
* git push --tags origin master
* trigger the manual 'release' stage of the build via the web UI when
this becomes possible. This requires a valid PRIVATE_TOKEN.
Announcing the release:
* checkout the sane/website.git module and:
* copy sane-backends.html to sane-backends-"old-version".html
* update sane-supported-devices.html with link to above "old" file
* rebuild sane-backends.html and sane-mfgs.html (make -C doc html-pages)
* use man2html from http://hydra.nac.uci.edu/indiv/ehood/man2html.html
* [TBD] checkout the sane/website.git module and:
* [TBD] copy sane-backends.html to sane-backends-"old-version".html
* [TBD] update sane-supported-devices.html with link to above "old" file
* [TBD] rebuild sane-backends.html and sane-mfgs.html (make -C doc html-pages)
* [TBD] use man2html from http://hydra.nac.uci.edu/indiv/ehood/man2html.html
to rebuild html man pages (make -C doc html-man) (no other version works)
* add md5 sum to sane-md5sums.txt
* check and update platforms page (sane-support.html)
* [TBD] add md5 sum to sane-md5sums.txt
* [TBD] check and update platforms page (sane-support.html)
* add announcement to index.html
* git commit -a && git push
* check that website was updated automatically. if not, see:
/home/groups/sane/bin/update-htdocs.sh
* rebuild descriptions.db (make -C doc descriptions.db)
* scp doc/descriptions.db to alioth:
/home/groups/sane/search/release
* write announcements sane-devel, maybe others (e.g. freshmeat),
include the md5 hash
* check that website was updated automatically
* [TBD] rebuild descriptions.db (make -C doc descriptions.db)
* announce release on sane-devel and sane-announce mailing lists
After the release:
* move ChangeLog to ChangeLogs/ChangeLog-"version"
* start a new ChangeLog, with the following message:
This file is automatically generated at release time using git commit
messages.
For the latest changes please refer to the output of `git log` or see:
https://gitlab.com/sane-project/backends/commits/master
* configure.ac: add 'git' suffix to textual version
* configure: regenerate with autoconf
* remove the ':new' tag from any new backends .desc files
* git add new files and commit
* git push && git push --tags (one of these might give an error 'remote: fatal: bad object 0000000000000000000000000000000000000000', try the other one)
* [TBD] copy ChangeLog to ChangeLogs/ChangeLog-$version
* [TBD] start a new ChangeLog via git checkout ChangeLog
* [TBD] bump version number in tools/create-changelog.sh
* remove the ':new' tag from all doc/descriptions*/*.desc files
* git add new and changed files and commit
* git push

Wyświetl plik

@ -0,0 +1,61 @@
#!/bin/sh -eux
# tools/create-release.sh -- via GitLab CI and API
# Copyright (C) 2019 Olaf Meeuwissen
#
# License: GPL-3.0+
GROUP=sane-project
PROJECT=backends
PROJECT_ID=$GROUP%2F$PROJECT
API_ENDPOINT=https://gitlab.com/api/v4
# Uploads a file and returns a project relative URL to it.
upload () {
curl --silent --fail \
--header "PRIVATE-TOKEN: $PRIVATE_TOKEN" \
--form "file=@$1" \
--request POST \
$API_ENDPOINT/projects/$PROJECT_ID/uploads \
| jq --raw-output .url \
| sed "s|^|https://gitlab.com/$GROUP/$PROJECT|"
}
cat << EOF > release.json
{
"name": "SANE Backends $CI_COMMIT_TAG",
"tag_name": "$CI_COMMIT_TAG",
"description": "$(sed '1,3d; / /{s/.*//; q}' NEWS \
| git stripspace \
| sed 's/"/\\"/g; s/$/\\n/g' \
| tr -d '\n')",
"assets": {
"links": [
EOF
for check in sha256 sha512; do
${check}sum sane-backends-$CI_COMMIT_TAG.tar.gz \
> sane-backends-$CI_COMMIT_TAG.$check.txt
cat << EOF >> release.json
{
"name": "sane-backends-$CI_COMMIT_TAG.$check.txt",
"url": "$(upload sane-backends-$CI_COMMIT_TAG.$check.txt)"
},
EOF
done
cat << EOF >> release.json
{
"name": "sane-backends-$CI_COMMIT_TAG.tar.gz",
"url": "$(upload sane-backends-$CI_COMMIT_TAG.tar.gz)"
}
]
}
}
EOF
curl --silent --fail --write-out "%{http_code}\n"\
--header "PRIVATE-TOKEN: $PRIVATE_TOKEN" \
--header "Content-Type: application/json" \
--data @release.json \
--request POST $API_ENDPOINT/projects/$PROJECT_ID/releases