Skip to content

Commit 278427b

Browse files
authored
Feat: Use Git for Version Management and Publish on Github Releases (#45)
1 parent 85c173f commit 278427b

File tree

7 files changed

+362
-36
lines changed

7 files changed

+362
-36
lines changed

.github/changelogtemplate.tpl

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{#versions}}
2+
{{{label}}}
3+
4+
{{#sections}}
5+
## {{{label}}}
6+
7+
{{#commits}}
8+
* {{{subject}}} - {{commit.sha1_short}} [{{{author}}}]
9+
{{#body}}
10+
11+
{{{body_indented}}}
12+
{{/body}}
13+
14+
{{/commits}}
15+
{{/sections}}
16+
17+
{{/versions}}

.github/gitchangelog.rc

+289
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
# -*- coding: utf-8; mode: python -*-
2+
##
3+
## Format
4+
##
5+
## ACTION: [AUDIENCE:] COMMIT_MSG [!TAG ...]
6+
##
7+
## Description
8+
##
9+
## ACTION is one of 'chg', 'fix', 'new'
10+
##
11+
## Is WHAT the change is about.
12+
##
13+
## 'chg' is for refactor, small improvement, cosmetic changes...
14+
## 'fix' is for bug fixes
15+
## 'new' is for new features, big improvement
16+
##
17+
## AUDIENCE is optional and one of 'dev', 'usr', 'pkg', 'test', 'doc'
18+
##
19+
## Is WHO is concerned by the change.
20+
##
21+
## 'dev' is for developpers (API changes, refactors...)
22+
## 'usr' is for final users (UI changes)
23+
## 'pkg' is for packagers (packaging changes)
24+
## 'test' is for testers (test only related changes)
25+
## 'doc' is for doc guys (doc only changes)
26+
##
27+
## COMMIT_MSG is ... well ... the commit message itself.
28+
##
29+
## TAGs are additionnal adjective as 'refactor' 'minor' 'cosmetic'
30+
##
31+
## They are preceded with a '!' or a '@' (prefer the former, as the
32+
## latter is wrongly interpreted in github.) Commonly used tags are:
33+
##
34+
## 'refactor' is obviously for refactoring code only
35+
## 'minor' is for a very meaningless change (a typo, adding a comment)
36+
## 'cosmetic' is for cosmetic driven change (re-indentation, 80-col...)
37+
## 'wip' is for partial functionality but complete subfunctionality.
38+
##
39+
## Example:
40+
##
41+
## new: usr: support of bazaar implemented
42+
## chg: re-indentend some lines !cosmetic
43+
## new: dev: updated code to be compatible with last version of killer lib.
44+
## fix: pkg: updated year of licence coverage.
45+
## new: test: added a bunch of test around user usability of feature X.
46+
## fix: typo in spelling my name in comment. !minor
47+
##
48+
## Please note that multi-line commit message are supported, and only the
49+
## first line will be considered as the "summary" of the commit message. So
50+
## tags, and other rules only applies to the summary. The body of the commit
51+
## message will be displayed in the changelog without reformatting.
52+
53+
54+
##
55+
## ``ignore_regexps`` is a line of regexps
56+
##
57+
## Any commit having its full commit message matching any regexp listed here
58+
## will be ignored and won't be reported in the changelog.
59+
##
60+
ignore_regexps = [
61+
r'@minor', r'!minor',
62+
r'@cosmetic', r'!cosmetic',
63+
r'@refactor', r'!refactor',
64+
r'@wip', r'!wip',
65+
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[p|P]kg:',
66+
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[d|D]ev:',
67+
r'^(.{3,3}\s*:)?\s*[fF]irst commit.?\s*$',
68+
r'^$', ## ignore commits with empty messages
69+
]
70+
71+
72+
## ``section_regexps`` is a list of 2-tuples associating a string label and a
73+
## list of regexp
74+
##
75+
## Commit messages will be classified in sections thanks to this. Section
76+
## titles are the label, and a commit is classified under this section if any
77+
## of the regexps associated is matching.
78+
##
79+
## Please note that ``section_regexps`` will only classify commits and won't
80+
## make any changes to the contents. So you'll probably want to go check
81+
## ``subject_process`` (or ``body_process``) to do some changes to the subject,
82+
## whenever you are tweaking this variable.
83+
##
84+
section_regexps = [
85+
('Change', [
86+
r'^[cH]ange\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
87+
]),
88+
('Feature', [
89+
r'^[fF]eat\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
90+
]),
91+
('Fix', [
92+
r'^[fF]ix\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
93+
]),
94+
95+
('Other', None ## Match all lines
96+
),
97+
98+
]
99+
100+
101+
## ``body_process`` is a callable
102+
##
103+
## This callable will be given the original body and result will
104+
## be used in the changelog.
105+
##
106+
## Available constructs are:
107+
##
108+
## - any python callable that take one txt argument and return txt argument.
109+
##
110+
## - ReSub(pattern, replacement): will apply regexp substitution.
111+
##
112+
## - Indent(chars=" "): will indent the text with the prefix
113+
## Please remember that template engines gets also to modify the text and
114+
## will usually indent themselves the text if needed.
115+
##
116+
## - Wrap(regexp=r"\n\n"): re-wrap text in separate paragraph to fill 80-Columns
117+
##
118+
## - noop: do nothing
119+
##
120+
## - ucfirst: ensure the first letter is uppercase.
121+
## (usually used in the ``subject_process`` pipeline)
122+
##
123+
## - final_dot: ensure text finishes with a dot
124+
## (usually used in the ``subject_process`` pipeline)
125+
##
126+
## - strip: remove any spaces before or after the content of the string
127+
##
128+
## - SetIfEmpty(msg="No commit message."): will set the text to
129+
## whatever given ``msg`` if the current text is empty.
130+
##
131+
## Additionally, you can `pipe` the provided filters, for instance:
132+
#body_process = Wrap(regexp=r'\n(?=\w+\s*:)') | Indent(chars=" ")
133+
#body_process = Wrap(regexp=r'\n(?=\w+\s*:)')
134+
body_process = noop
135+
#body_process = ReSub(r'((^|\n)[A-Z]\w+(-\w+)*: .*(\n\s+.*)*)+$', r'') | strip
136+
137+
138+
## ``subject_process`` is a callable
139+
##
140+
## This callable will be given the original subject and result will
141+
## be used in the changelog.
142+
##
143+
## Available constructs are those listed in ``body_process`` doc.
144+
subject_process = (strip |
145+
ReSub(r'^([cC]hange|[fF]eature|[fF]ix)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n@]*)(@[a-z]+\s+)*$', r'\4') |
146+
SetIfEmpty("No commit message.") | ucfirst | final_dot)
147+
148+
149+
## ``tag_filter_regexp`` is a regexp
150+
##
151+
## Tags that will be used for the changelog must match this regexp.
152+
##
153+
tag_filter_regexp = r'^V[0-9]+\.[0-9]+(\.[0-9]+)?$'
154+
155+
156+
## ``unreleased_version_label`` is a string or a callable that outputs a string
157+
##
158+
## This label will be used as the changelog Title of the last set of changes
159+
## between last valid tag and HEAD if any.
160+
unreleased_version_label = "(unreleased)"
161+
162+
163+
## ``output_engine`` is a callable
164+
##
165+
## This will change the output format of the generated changelog file
166+
##
167+
## Available choices are:
168+
##
169+
## - rest_py
170+
##
171+
## Legacy pure python engine, outputs ReSTructured text.
172+
## This is the default.
173+
##
174+
## - mustache(<template_name>)
175+
##
176+
## Template name could be any of the available templates in
177+
## ``templates/mustache/*.tpl``.
178+
## Requires python package ``pystache``.
179+
## Examples:
180+
## - mustache("markdown")
181+
## - mustache("restructuredtext")
182+
##
183+
## - makotemplate(<template_name>)
184+
##
185+
## Template name could be any of the available templates in
186+
## ``templates/mako/*.tpl``.
187+
## Requires python package ``mako``.
188+
## Examples:
189+
## - makotemplate("restructuredtext")
190+
##
191+
#output_engine = rest_py
192+
#output_engine = mustache("restructuredtext")
193+
output_engine = mustache(".github/changelogtemplate.tpl")
194+
#output_engine = makotemplate("restructuredtext")
195+
196+
197+
## ``include_merge`` is a boolean
198+
##
199+
## This option tells git-log whether to include merge commits in the log.
200+
## The default is to include them.
201+
include_merge = False
202+
203+
204+
## ``log_encoding`` is a string identifier
205+
##
206+
## This option tells gitchangelog what encoding is outputed by ``git log``.
207+
## The default is to be clever about it: it checks ``git config`` for
208+
## ``i18n.logOutputEncoding``, and if not found will default to git's own
209+
## default: ``utf-8``.
210+
#log_encoding = 'utf-8'
211+
212+
213+
## ``publish`` is a callable
214+
##
215+
## Sets what ``gitchangelog`` should do with the output generated by
216+
## the output engine. ``publish`` is a callable taking one argument
217+
## that is an interator on lines from the output engine.
218+
##
219+
## Some helper callable are provided:
220+
##
221+
## Available choices are:
222+
##
223+
## - stdout
224+
##
225+
## Outputs directly to standard output
226+
## (This is the default)
227+
##
228+
## - FileInsertAtFirstRegexMatch(file, pattern, idx=lamda m: m.start())
229+
##
230+
## Creates a callable that will parse given file for the given
231+
## regex pattern and will insert the output in the file.
232+
## ``idx`` is a callable that receive the matching object and
233+
## must return a integer index point where to insert the
234+
## the output in the file. Default is to return the position of
235+
## the start of the matched string.
236+
##
237+
## - FileRegexSubst(file, pattern, replace, flags)
238+
##
239+
## Apply a replace inplace in the given file. Your regex pattern must
240+
## take care of everything and might be more complex. Check the README
241+
## for a complete copy-pastable example.
242+
##
243+
# publish = FileInsertIntoFirstRegexMatch(
244+
# "CHANGELOG.rst",
245+
# r'/(?P<rev>[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n/',
246+
# idx=lambda m: m.start(1)
247+
# )
248+
#publish = stdout
249+
250+
251+
## ``revs`` is a list of callable or a list of string
252+
##
253+
## callable will be called to resolve as strings and allow dynamical
254+
## computation of these. The result will be used as revisions for
255+
## gitchangelog (as if directly stated on the command line). This allows
256+
## to filter exaclty which commits will be read by gitchangelog.
257+
##
258+
## To get a full documentation on the format of these strings, please
259+
## refer to the ``git rev-list`` arguments. There are many examples.
260+
##
261+
## Using callables is especially useful, for instance, if you
262+
## are using gitchangelog to generate incrementally your changelog.
263+
##
264+
## Some helpers are provided, you can use them::
265+
##
266+
## - FileFirstRegexMatch(file, pattern): will return a callable that will
267+
## return the first string match for the given pattern in the given file.
268+
## If you use named sub-patterns in your regex pattern, it'll output only
269+
## the string matching the regex pattern named "rev".
270+
##
271+
## - Caret(rev): will return the rev prefixed by a "^", which is a
272+
## way to remove the given revision and all its ancestor.
273+
##
274+
## Please note that if you provide a rev-list on the command line, it'll
275+
## replace this value (which will then be ignored).
276+
##
277+
## If empty, then ``gitchangelog`` will act as it had to generate a full
278+
## changelog.
279+
##
280+
## The default is to use all commits to make the changelog.
281+
#revs = ["^1.0.3", ]
282+
#revs = [
283+
# Caret(
284+
# FileFirstRegexMatch(
285+
# "CHANGELOG.rst",
286+
# r"(?P<rev>[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n")),
287+
# "HEAD"
288+
#]
289+
revs = []

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This is a Gui for OpenZWave, intended to replace the open-zwave-control-panel eventually.
33

44
Latest Installer Images/AppImages can be found here:
5-
http://bamboo.my-ho.st/bamboo/browse/OZW-OZW/latestSuccessful/artifact
5+
https://github.com/OpenZWave/ozw-admin/releases
66

77
Work in Progress. Don't expect much right now :)
88

ozwadmin-main/ozwadmin-main.pro

+18
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,28 @@ TEMPLATE = app
1313
isEmpty(BUILDNUMBER) {
1414
BUILDNUMBER = 0
1515
}
16+
GIT_VERSION_TAG=$$system(git describe --tags --match *.0)
17+
message($$GIT_VERSION_TAG)
18+
GIT_VERSIONS = $$split(GIT_VERSION_TAG, "-")
19+
message($$GIT_VERSIONS)
20+
BUILDNUMBER=$$member(GIT_VERSIONS, 1)
21+
1622
VERSION = 0.1.$$BUILDNUMBER
1723
message("Building Version $$VERSION")
1824

1925
DEFINES +=APP_VERSION=$$VERSION
26+
unix {
27+
packagefiles.input=$$PWD/../scripts/version.in
28+
packagefiles.output=$$PWD/../scripts/version
29+
QMAKE_SUBSTITUTES += packagefiles
30+
}
31+
win32 {
32+
packagefiles.input=$$PWD\..\scripts\package.nsis.in
33+
packagefiles.output=$$PWD\..\scripts\package.nsis
34+
QMAKE_SUBSTITUTES += packagefiles
35+
message("doing Substitutions")
36+
}
37+
2038

2139
SOURCES += main.cpp\
2240
configuration.cpp \

scripts/build.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,23 @@ git clone https://github.com/OpenZWave/qt-openzwave.git && cd qt-openzwave && /o
88
cd /opt
99
git clone https://github.com/OpenZWave/ozw-admin.git && cd ozw-admin && /opt/qt512/bin/qmake -r CONFIG+=release && make -j4 && make install
1010
cd /opt
11-
#mkdir -p /opt/AppDir/usr/lib/
12-
#cp /opt/open-zwave/libopenzwave.so* /opt/AppDir/usr/lib/
13-
#cp /opt/qt-openzwave/qt-openzwave/*.so* /opt/AppDir/usr/lib
14-
#cp /opt/qt-openzwave/qt-openzwavedatabase/*.so* /opt/AppDir/usr/lib
11+
1512
mkdir -p /opt/AppDir/usr/bin
1613
cp /opt/ozw-admin/ozwadmin /opt/AppDir/usr/bin/
1714
mkdir -p /opt/AppDir/usr/share/OpenZWave/
1815
cp /opt/qt-openzwave/qt-openzwavedatabase/*.rcc /opt/AppDir/usr/share/OpenZWave/
1916
mkdir -p /opt/AppDir/usr/plugins/platforms/
2017
cp /opt/qt512/plugins/platforms/libqvnc.so /opt/AppDir/usr/plugins/platforms/
2118
mkdir -p /opt/AppDir/usr/share/metainfo/
22-
#cp /opt/ozw-admin/scripts/ozwadmin.appdata.xml /opt/AppDir/usr/share/metainfo/
19+
2320
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64
2421
export QMAKE=/opt/qt512/bin/qmake
25-
export VERSION=0.1
22+
export VERSION=$(cat /opt/ozw-admin/scripts/version)
23+
2624
cd /opt && ./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin qt --output appimage -d ozw-admin/scripts/ozwadmin.desktop -i ozw-admin/scripts/ozwadmin.png
27-
#cd ozw-admin && ../linuxdeploy-x86_64.AppImage --appdir AppDir -e ozwadmin --plugin qt --output appimage -d scripts/ozwadmin.desktop -i scripts/ozwadmin.png
25+
2826
cp /opt/OZWAdmin-*.AppImage /opt/buildfiles/
27+
cp /opt/ozw-admin/scripts/version /opt/buildfiles/
28+
2929
chown $DOCKERUSERID:$DOCKERGROUPID /opt/buildfiles/OZWAdmin-*.AppImage
30+
chown $DOCKERUSERID:$DOCKERGROUPID /opt/buildfiles/version

0 commit comments

Comments
 (0)