34 lines
864 B
YAML
34 lines
864 B
YAML
name: shell_hash
|
|
description: 获取文件哈希
|
|
|
|
inputs:
|
|
file_array:
|
|
required: true
|
|
description: 文件路径
|
|
|
|
outputs:
|
|
hash:
|
|
description: 文件哈希
|
|
value: ${{ steps.get_hash.outputs.res }}
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: 获取最新发布版本号
|
|
id: get_hash
|
|
shell: bash
|
|
run: |
|
|
# 初始化 res 变量
|
|
res=""
|
|
fileStr=(${INPUT_FILE_ARRAY//,/ })
|
|
# 读取 fileStr 变量中的每一行文件路径
|
|
for filepath in ${fileStr[@]}; do
|
|
file_hash=$(md5sum "$filepath" | awk '{print $1}')
|
|
res+="$file_hash"
|
|
done
|
|
|
|
# 计算 res 的哈希值
|
|
final_hash=$(echo -n "$res" | md5sum | awk '{print $1}')
|
|
|
|
echo "res=$final_hash" >> "$GITHUB_OUTPUT"
|
|
echo "final_hash=$final_hash" |