forked from saltstack-formulas/template-formula
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre-commit_semantic-release.sh
executable file
·36 lines (26 loc) · 1.16 KB
/
pre-commit_semantic-release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
###############################################################################
# (A) Update `FORMULA` with `${nextRelease.version}`
###############################################################################
sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA
# ###############################################################################
# # (B) Update `adoc/antora.yml` with `${nextRelease.version}`
# ###############################################################################
# sed -i -e "s_^\(version:\).*_\1 '${1}'_" adoc/antora.yml
###############################################################################
# (C) Use `m2r` to convert automatically produced `.md` docs to `.rst`
###############################################################################
# Install `m2r`
sudo -H pip install m2r
# Copy and then convert the `.md` docs
cp *.md docs/
cd docs/
m2r --overwrite *.md
# Change excess `H1` headings to `H2` in converted `CHANGELOG.rst`
sed -i -e '/^=.*$/s/=/-/g' CHANGELOG.rst
sed -i -e '1,4s/-/=/g' CHANGELOG.rst
# Use for debugging output, when required
# cat AUTHORS.rst
# cat CHANGELOG.rst
# Return back to the main directory
cd ..