Skip to content

Commit

Permalink
fix(build): add hash to statementsensei tar.gz
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin-awd committed Nov 15, 2024
1 parent e4d6800 commit 5fe8bcc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions .github/hooks/include_webapp_in_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
REQUIREMENTS_FILE="requirements.txt"
VERSION=$(poetry version --short)
TAR_FILE="dist/statement_sensei-$VERSION.tar.gz"
HASH=$(sha256sum "$TAR_FILE" | awk '{ print $1 }')

poetry export -f requirements.txt --output requirements.txt --extras ocrmypdf --without dev

if [ -f "$REQUIREMENTS_FILE" ]; then
FIRST_LINE=$(head -n 1 "$REQUIREMENTS_FILE")
if [ "$FIRST_LINE" != "$TAR_FILE" ]; then
echo "Adding $TAR_FILE to the top of $REQUIREMENTS_FILE"
(echo "$TAR_FILE" && cat "$REQUIREMENTS_FILE") > "$REQUIREMENTS_FILE.tmp"
# Create the required entry with hash
TAR_WITH_HASH="dist/statement_sensei-$VERSION.tar.gz --hash=sha256:$HASH"

if [ "$FIRST_LINE" != "$TAR_WITH_HASH" ]; then
echo "Adding $TAR_WITH_HASH to the top of $REQUIREMENTS_FILE"
(echo "$TAR_WITH_HASH" && cat "$REQUIREMENTS_FILE") > "$REQUIREMENTS_FILE.tmp"
mv "$REQUIREMENTS_FILE.tmp" "$REQUIREMENTS_FILE"
fi
else
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dist/statement_sensei-0.7.4.tar.gz
dist/statement_sensei-0.7.4.tar.gz --hash=sha256:aa758d0429a060da5f8b07f41153d41a5d8b472ed3d0ceeb01f3239d2f585a1b
altair==5.4.1 ; python_version >= "3.10" and python_version < "3.13" \
--hash=sha256:0ce8c2e66546cb327e5f2d7572ec0e7c6feece816203215613962f0ec1d76a82 \
--hash=sha256:0fb130b8297a569d08991fb6fe763582e7569f8a04643bbd9212436e3be04aef
Expand Down

0 comments on commit 5fe8bcc

Please sign in to comment.