Skip to content

Commit 0390b12

Browse files
committed
Automatically generate version numbers from CI
1 parent 25d1f52 commit 0390b12

6 files changed

Lines changed: 21 additions & 5 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
- run: apt-get update
1818
- run: apt-get -y install build-essential git openssh-client dpkg-dev debhelper dh-python pybuild-plugin-pyproject python3-all python3-setuptools
1919
- checkout
20+
- run: ./generate_release.sh
2021
- run: make -f debian/rules binary
2122
- run: mkdir -p /root/build
2223
- run: mv ../*.deb /root/build

debian/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
changelog

debian/changelog

Lines changed: 0 additions & 5 deletions
This file was deleted.

debian/changelog.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
python-osc ($RELEASE) stable; urgency=medium
2+
3+
* Released
4+
5+
-- FOSDEM Team <noreply@fosdem.org> $DATE

debian/rules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
export PYBUILD_NAME=osc
44

55
%:
6+
./generate_release.sh
67
dh $@ --buildsystem=pybuild --with=python3

generate_release.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [[ $CIRCLE_TAG =~ ^v[0-9].* ]]; then
5+
RVERSION="${CIRCLE_TAG:1}"
6+
else
7+
RVERSION="0.0.${CIRCLE_BUILD_NUM:=1}"
8+
fi
9+
10+
#RVERSION="$(${CIRCLE_TAG:=0.0.${CIRCLE_BUILD_NUM:-1}} | sed 's/[^0-9\.]*//g')"
11+
RDATE="$(date -R)"
12+
13+
sed -e 's/$RELEASE/'"$RVERSION"'/' -e 's/$DATE/'"$RDATE"'/' debian/changelog.template > debian/changelog

0 commit comments

Comments
 (0)