Skip to content

Commit

Permalink
feat(push): add support to push compiled pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
vinay0410 committed Oct 25, 2019
1 parent 4ed0e65 commit a2c3d05
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
21 changes: 15 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a2c3d05

Please sign in to comment.