Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding render option to the actions "render" and "publish" and cleaning code #108

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ inputs:
description: 'If not true, do not render project before publishing'
required: false
default: "true"
profile:
description: 'Profiles to use when rendering the quarto project'
required: false
default: ""
runs:
using: 'composite'
steps:
Expand All @@ -50,12 +54,20 @@ runs:
run: |
git config --global user.email "${{ inputs.GITHUB_EMAIL }}"
git config --global user.name "${{ inputs.GITHUB_USERNAME }}"

TARGET="${{ inputs.to }}"
if [ "$TARGET" == "" ]; then
if [ -z "$TARGET" ]; then
TARGET="${{ inputs.target }}"
fi

publish_command="quarto publish $TARGET ${{ inputs.path }} --no-browser"

if [ "${{ inputs.render }}" != "true" ]; then
quarto publish $TARGET ${{ inputs.path }} --no-render --no-browser
else
quarto publish $TARGET ${{ inputs.path }} --no-browser
publish_command="$publish_command --no-render"
fi

if [ ! -z "${{ inputs.profile }}" ]; then
publish_command="$publish_command --profile ${{ inputs.profile }}"
fi

eval $publish_command
14 changes: 10 additions & 4 deletions render/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ inputs:
description: 'Subdirectory containing the quarto project to be rendered'
required: false
default: "."
profile:
description: 'Profiles to use when rendering the quarto project'
required: false
runs:
using: 'composite'
steps:
Expand All @@ -26,11 +29,14 @@ runs:
env:
QUARTO_PRINT_STACK: true
run: |
if [ "${{ inputs.to }}" == "" ]; then
quarto render ${{ inputs.path }}
else
quarto render ${{ inputs.path }} --to ${{ inputs.to }}
render_command="quarto render ${{ inputs.path }}"
if [ ! -z "${{ inputs.to }}" ]; then
render_command="$render_command --to ${{ inputs.to }}"
fi
if [ ! -z "${{ inputs.profile }}" ]; then
render_command="$render_command --profile ${{ inputs.profile }}"
fi
eval $render_command
if [ -f "_book" ]; then
echo "QUARTO_OUTPUT=_book" >> $GITHUB_ENV
elif [ -f "_site" ]; then
Expand Down