Skip to content

Commit

Permalink
fix branch not getting detected properly
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertLucian committed Jan 22, 2019
1 parent fdec397 commit 5a6b80c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
docs/build
.vscode/
*.pyc
*.pyc
docs/source/branch
9 changes: 8 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@

commit_hash = os.popen('git rev-parse HEAD').read().strip()
latest_version = os.popen('git describe --tags --abbrev=0').read().strip()
branch = os.popen('git rev-parse --abbrev-ref HEAD').read().strip()
os.popen('bash find_branch.sh')
branch = os.popen('cat branch').read().strip()

# The short X.Y version
version = os.popen('git tag --points-at ' + commit_hash).read().strip()
# The full version, including alpha/beta/rc tags
release = version

print("Found branch '%s'" % branch)
print("Latest version is %s" % latest_version)
print("Current version is %s" % version)
print("Git has commit is %s" % commit_hash)

if len(version) > 0:
rst_epilog = ' .. |firmware| replace:: `here <https://dexind.s3.amazonaws.com/micropython-gigglebot/firmware/%s/%s-dexterindustries-gb-firmware.hex>`__' % (version, version)
rst_epilog += '\n .. |fwversion| replace:: **%s**' % version
Expand Down
3 changes: 3 additions & 0 deletions docs/source/find_branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! #!/bin/bash

git for-each-ref --format='%(objectname) %(refname:short)' refs/heads | awk "/^$(git rev-parse HEAD)/ {print \$2}" > branch

0 comments on commit 5a6b80c

Please sign in to comment.