我想将此实现为 Makefile 任务:
# step 1:
curl -u username:password -X POST \
-d '{"name": "new_file.jpg","size": 114034,"description": "Latest release","content_type": "text/plain"}' \
https://api.github.com/repos/:user/:repo/downloads
# step 2:
curl -u username:password \
-F "key=downloads/octocat/Hello-World/new_file.jpg" \
-F "acl=public-read" \
-F "success_action_status=201" \
-F "Filename=new_file.jpg" \
-F "AWSAccessKeyId=1ABCDEF..." \
-F "Policy=ewogIC..." \
-F "Signature=mwnF..." \
-F "Content-Type=image/jpeg" \
-F "file=@new_file.jpg" \
https://github.s3.amazonaws.com/
但是,在第一部分中,我需要获取文件大小(如果很容易,还需要获取内容类型,但不是必需的),因此需要一些变量:
{"name": "new_file.jpg","size": $(FILE_SIZE),"description": "Latest release","content_type": "text/plain"}
我试过了,但它不起作用(Mac 10.6.7):
$(shell du path/to/file.js | awk '{print $1}')
任何想法如何做到这一点?