diff --git a/Dockerfile b/Dockerfile index 1cf260c..5ddafd5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Container image that runs your code -FROM dxjoke/tectonic-docker:latest +FROM vinay0410/tectonic-image:latest # Copies your code file from your action repository to the filesystem path `/` of the container COPY entrypoint.sh /entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh index 6a55923..72feb05 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,14 +1,23 @@ #!/bin/sh -l +set -e + echo "Compiling $1" tectonic $1 -curl -i -X PUT -H "Authorization: token $ACTIONS_RUNTIME_TOKEN" -d '{ +OUTPUT_PDF="${1%.*}.pdf" + +STATUSCODE=$(curl --silent --output /dev/stderr --write-out "%{http_code}" -i -X PUT -H "Authorization: token $GITHUB_TOKEN" -d '{ "message": "update resume", "committer": { - "name": "Vinay Sharma", - "email": "vinay0410@github.com" + "name": "Tectonic Action", + "email": "tectonic-action@github.com" }, - "content": "'"$(base64 -w 0 myResume.pdf)"'", - "sha": '$(curl -X GET https://api.github.com/repos/vinay0410/webpage/contents/resume/myResume.pdf | jq .sha)' -}' https://api.github.com/repos/vinay0410/webpage/contents/resume/myResume.pdf + "content": "'"$(base64 -w 0 $OUTPUT_PDF)"'", + "sha": '$(curl -X GET https://api.github.com/repos/vinay0410/webpage/contents/$OUTPUT_PDF | jq .sha)' +}' https://api.github.com/repos/vinay0410/webpage/contents/$OUTPUT_PDF) + +if [ $((STATUSCODE/100)) -ne 2 ]; then + echo "Github's API returned $STATUSCODE" + exit 22; +fi