Skip to content

Commit

Permalink
Merge pull request #3 from vinay0410/add/input
Browse files Browse the repository at this point in the history
feat(push): add input
  • Loading branch information
vinay0410 authored Dec 16, 2019
2 parents d301c9c + 32248a3 commit b313802
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,35 @@ This action compiles latex files using [Tectonic](https://tectonic-typesetting.g

**Required** Path of tex, xtx file to compile.

### `push`

**Optional** Compiled PDF is pushed, if `push` is passed as 'yes'.

## Outputs
Pushes a Compiled PDF file parallel to the tex, xtx file.
Pushes a Compiled PDF file parallel to the tex, xtx file, if push is passed as 'yes'.

## Example usage

### Pushes Compiled PDF
```
on: [push]
jobs:
latex-job:
runs-on: ubuntu-latest
name: A job to Compile Latex file
steps:
- uses: actions/checkout@v1
- name: Compilation
uses: vinay0410/tectonic-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tex_path: 'dir/file.tex'
push: 'yes'
```

### Doesn't Push Compiled PDF
```
on: [push]
Expand Down
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ inputs:
tex_path: # id of input
description: 'Path of Tex File'
required: true
push:
description: 'String stating whether to push output PDF, PDF will only be pushed in case of "yes"'
default: 'no'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.tex_path }}
- ${{ inputs.tex_path }}
- ${{ inputs.push }}
7 changes: 6 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/usr/bin/env bash

set -e

echo "Compiling $1"
tectonic $1

PUSH_OUTPUT=$(echo "$2" | tr '[:upper:]' '[:lower:]')

if [[ $PUSH_OUTPUT != "yes" ]]; then # Don't push PDF
exit 0;
fi

OUTPUT_PDF="${1%.*}.pdf"

if [[ ${OUTPUT_PDF:0:1} == "/" ]]; then
Expand Down

0 comments on commit b313802

Please sign in to comment.