-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
44 lines (35 loc) · 1.23 KB
/
entrypoint.sh
File metadata and controls
44 lines (35 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
set -e
# Change to working directory if specified
if [ -n "$INPUT_WORKING_DIRECTORY" ] && [ "$INPUT_WORKING_DIRECTORY" != "." ]; then
cd "$INPUT_WORKING_DIRECTORY"
elif [ -n "$TYPSTIFY_WORKING_DIR" ] && [ "$TYPSTIFY_WORKING_DIR" != "." ]; then
cd "$TYPSTIFY_WORKING_DIR"
fi
# If arguments are provided (via args in action.yml or manual override), execute them directly
if [ $# -gt 0 ]; then
exec typstify "$@"
fi
# Otherwise, construct command from inputs
# Note: --config is a global argument and must be placed before the subcommand
CMD="typstify --config ${INPUT_CONFIG:-config.toml}"
SUBCOMMAND="${INPUT_COMMAND:-build}"
CMD="$CMD $SUBCOMMAND"
# Add subcommand specific arguments
if [ "$SUBCOMMAND" = "build" ]; then
CMD="$CMD --output ${INPUT_OUTPUT:-public}"
if [ "$INPUT_DRAFTS" = "true" ]; then
CMD="$CMD --drafts"
fi
# Add host override if specified
if [ -n "$INPUT_HOST" ]; then
CMD="$CMD --host $INPUT_HOST"
fi
# Add base-path override if specified (can be empty string to reset to no path)
if [ -n "${INPUT_BASE_PATH+x}" ]; then
CMD="$CMD --base-path \"$INPUT_BASE_PATH\""
fi
fi
# Execute the constructed command
echo "Executing: $CMD"
exec $CMD