From 9f6fe8318ce8da80ce5383c5fc0fa8f90ad0b2c8 Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Fri, 28 Feb 2020 12:14:18 +0000 Subject: [PATCH] CI: Test that any bump to changelog has a corresponding tag Prevents forgetting to sign the tag, which is currently done out of band and independently of review. --- .gitlab-ci.yml | 10 ++++++++++ debian/check_release.py | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100755 debian/check_release.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index edeceef7..0f5a6701 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -84,3 +84,13 @@ test: script: - apt-get -y build-dep . - ninja -C _build test + +check_release: + <<: *tags + stage: test + only: + refs: + - master + script: + - apt-get install git python3 + - (head -n 1 ./debian/changelog && git tag) | ./debian/check_release.py diff --git a/debian/check_release.py b/debian/check_release.py new file mode 100755 index 00000000..66788911 --- /dev/null +++ b/debian/check_release.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +"""Checks tag before release. +Feed it the first changelog line, and then all available tags. +""" + +import re, sys +tag = "v" + re.findall("\\((.*)\\)", input())[0] +if tag not in map(str.strip, sys.stdin.readlines()): + raise Exception("Changelog's current version doesn't have a tag. Push the tag!")