-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* make scheme choice as an input * allow to choose texlive version * allow using custom docker image
- Loading branch information
Showing
7 changed files
with
205 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# vim: set ft=dosini nospell: | ||
# document: http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
run() { | ||
echo -e "\033[1;34m$@\033[0m" | ||
"$@" | ||
} | ||
|
||
error() { | ||
echo "::error :: $1" | ||
exit 1 | ||
} | ||
|
||
scheme="${1}" | ||
texlive_version="${2}" | ||
docker_image="${3}" | ||
run="${4}" | ||
|
||
if [[ -n "$scheme" && -n "$docker_image" ]]; then | ||
error "Input 'scheme' and 'docker_image' cannot co-exist". | ||
fi | ||
|
||
if [[ -n "$texlive_version" && -n "$docker_image" ]]; then | ||
error "Input 'texlive_version' and 'docker_image' cannot co-exist". | ||
fi | ||
|
||
if [[ -z "$docker_image" ]]; then | ||
case "$texlive_version" in | ||
"" | "latest" | "2023") | ||
image_version="latest" | ||
;; | ||
"2022") | ||
image_version="20230301" | ||
;; | ||
"2021") | ||
image_version="20220201" | ||
;; | ||
"2020") | ||
image_version="20210301" | ||
;; | ||
*) | ||
error "TeX Live version $texlive_version is not supported. The currently supported versions are 2020-2023 or latest." | ||
;; | ||
esac | ||
docker_image="ghcr.io/xu-cheng/texlive-$scheme:$image_version" | ||
fi | ||
|
||
# ref: https://docs.miktex.org/manual/envvars.html | ||
run docker run --rm \ | ||
-e "BIBINPUTS" \ | ||
-e "BSTINPUTS" \ | ||
-e "MFINPUTS" \ | ||
-e "TEXINPUTS" \ | ||
-e "TFMFONTS" \ | ||
-e "HOME" \ | ||
-e "GITHUB_JOB" \ | ||
-e "GITHUB_REF" \ | ||
-e "GITHUB_SHA" \ | ||
-e "GITHUB_REPOSITORY" \ | ||
-e "GITHUB_REPOSITORY_OWNER" \ | ||
-e "GITHUB_REPOSITORY_OWNER_ID" \ | ||
-e "GITHUB_RUN_ID" \ | ||
-e "GITHUB_RUN_NUMBER" \ | ||
-e "GITHUB_RETENTION_DAYS" \ | ||
-e "GITHUB_RUN_ATTEMPT" \ | ||
-e "GITHUB_REPOSITORY_ID" \ | ||
-e "GITHUB_ACTOR_ID" \ | ||
-e "GITHUB_ACTOR" \ | ||
-e "GITHUB_TRIGGERING_ACTOR" \ | ||
-e "GITHUB_WORKFLOW" \ | ||
-e "GITHUB_HEAD_REF" \ | ||
-e "GITHUB_BASE_REF" \ | ||
-e "GITHUB_EVENT_NAME" \ | ||
-e "GITHUB_SERVER_URL" \ | ||
-e "GITHUB_API_URL" \ | ||
-e "GITHUB_GRAPHQL_URL" \ | ||
-e "GITHUB_REF_NAME" \ | ||
-e "GITHUB_REF_PROTECTED" \ | ||
-e "GITHUB_REF_TYPE" \ | ||
-e "GITHUB_WORKFLOW_REF" \ | ||
-e "GITHUB_WORKFLOW_SHA" \ | ||
-e "GITHUB_WORKSPACE" \ | ||
-e "GITHUB_ACTION" \ | ||
-e "GITHUB_EVENT_PATH" \ | ||
-e "GITHUB_ACTION_REPOSITORY" \ | ||
-e "GITHUB_ACTION_REF" \ | ||
-e "GITHUB_PATH" \ | ||
-e "GITHUB_ENV" \ | ||
-e "GITHUB_STEP_SUMMARY" \ | ||
-e "GITHUB_STATE" \ | ||
-e "GITHUB_OUTPUT" \ | ||
-e "RUNNER_OS" \ | ||
-e "RUNNER_ARCH" \ | ||
-e "RUNNER_NAME" \ | ||
-e "RUNNER_ENVIRONMENT" \ | ||
-e "RUNNER_TOOL_CACHE" \ | ||
-e "RUNNER_TEMP" \ | ||
-e "RUNNER_WORKSPACE" \ | ||
-e "ACTIONS_RUNTIME_URL" \ | ||
-e "ACTIONS_RUNTIME_TOKEN" \ | ||
-e "ACTIONS_CACHE_URL" \ | ||
-e GITHUB_ACTIONS=true \ | ||
-e CI=true \ | ||
-v "/var/run/docker.sock":"/var/run/docker.sock" \ | ||
-v "$HOME:$HOME" \ | ||
-v "$GITHUB_ENV:$GITHUB_ENV" \ | ||
-v "$GITHUB_OUTPUT:$GITHUB_OUTPUT" \ | ||
-v "$GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY" \ | ||
-v "$GITHUB_PATH:$GITHUB_PATH" \ | ||
-v "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" \ | ||
-w "$GITHUB_WORKSPACE" \ | ||
"$docker_image" \ | ||
/bin/bash -eo pipefail -c -- \ | ||
"$run" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Github Action with TeXLive | ||
description: Run arbitrary commands in a TeXLive environment. | ||
author: Cheng XU | ||
inputs: | ||
run: | ||
description: Arbitrary bash codes to be executed | ||
required: true | ||
scheme: | ||
description: The scheme of TeXLive to be used, either full or small | ||
default: full | ||
texlive_version: | ||
description: The version of TeXLive to be used | ||
docker_image: | ||
description: The docker image to be used | ||
runs: | ||
using: composite | ||
steps: | ||
- shell: bash | ||
run: | | ||
"${GITHUB_ACTION_PATH}/action.sh" \ | ||
"${{ inputs.scheme }}" \ | ||
"${{ inputs.texlive_version }}" \ | ||
"${{ inputs.docker_image }}" \ | ||
"${{ inputs.run }}" | ||
branding: | ||
icon: book | ||
color: blue |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.