mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-10 06:34:16 +00:00
include git refs and HEAD file in docker images to allow GIT_SHA of builds to show in version output
This commit is contained in:
parent
4af9beedd1
commit
b0da386793
2 changed files with 4 additions and 2 deletions
|
@ -5,10 +5,12 @@ __pycache__/
|
|||
.mypy_cache/
|
||||
.pytest_cache/
|
||||
.github/
|
||||
.git/
|
||||
.pdm-build/
|
||||
.pdm-python
|
||||
.eggs/
|
||||
.git/
|
||||
!.git/HEAD
|
||||
!.git/refs/heads/*
|
||||
|
||||
venv/
|
||||
.venv/
|
||||
|
|
|
@ -399,7 +399,7 @@ def get_version(config):
|
|||
|
||||
def get_commit_hash(config) -> Optional[str]:
|
||||
try:
|
||||
git_dir = config['PACKAGE_DIR'] / '../'
|
||||
git_dir = config['PACKAGE_DIR'] / '../.git'
|
||||
ref = (git_dir / 'HEAD').read_text().strip().split(' ')[-1]
|
||||
commit_hash = git_dir.joinpath(ref).read_text().strip()
|
||||
return commit_hash
|
||||
|
|
Loading…
Reference in a new issue