File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ inputs:
30
30
description : Show verbose output.
31
31
required : false
32
32
default : false
33
+ print_hash :
34
+ description : Show hash values of files uploaded
35
+ required : false
36
+ default : false
33
37
branding :
34
38
color : yellow
35
39
icon : upload-cloud
44
48
- ${{ inputs.verify_metadata }}
45
49
- ${{ inputs.skip_existing }}
46
50
- ${{ inputs.verbose }}
51
+ - ${{ inputs.print_hash }}
Original file line number Diff line number Diff line change @@ -48,3 +48,29 @@ TWINE_USERNAME="$INPUT_USER" \
48
48
TWINE_PASSWORD=" $INPUT_PASSWORD " \
49
49
TWINE_REPOSITORY_URL=" $INPUT_REPOSITORY_URL " \
50
50
exec twine upload ${TWINE_EXTRA_ARGS} ${INPUT_PACKAGES_DIR%%/ } /*
51
+
52
+ if [[ ${INPUT_PRINT_HASH,,} != " false" ]] ; then
53
+ cat > ./print_hash.py << EOF
54
+ import os
55
+ import hashlib
56
+ sha256 = hashlib.sha256()
57
+ md5 = hashlib.md5()
58
+ blake2_256 = hashlib.blake2b(digest_size=256 // 8)
59
+ file_list = os.listdir(os.path.abspath("${INPUT_PACKAGES_DIR%%/ } "))
60
+ for i in file_list:
61
+ print(i)
62
+ print("")
63
+ file = open(os.path.abspath(os.path.join("${INPUT_PACKAGES_DIR%%/ } ", i)), "rb")
64
+ content = file.read()
65
+ file.close()
66
+ sha256.update(content)
67
+ md5.update(content)
68
+ blake2_256.update(content)
69
+ print(f"SHA256: {sha256.hexdigest()}")
70
+ print(f"MD5: {md5.hexdigest()}")
71
+ print(f"BLAKE2-256: {blake2_256.hexdigest()}")
72
+ print("")
73
+ EOF
74
+ python ./print_hash.py
75
+ rm ./print_hash.py
76
+ fi
You can’t perform that action at this time.
0 commit comments