Skip to content

Commit fc45c72

Browse files
author
github-action
committed
new update of dtcw
1 parent ae33ae7 commit fc45c72

3 files changed

Lines changed: 49 additions & 15 deletions

File tree

dtcw

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ set -o pipefail
1212

1313
# See https://github.com/docToolchain/docToolchain/releases for available versions.
1414
# Set DTC_VERSION to "latest" to get the latest, yet unreleased version.
15-
: "${DTC_VERSION:=3.2.0}"
15+
: "${DTC_VERSION:=3.2.1}"
1616

1717
# The 'generateSite' and 'copyThemes' tasks support DTC_SITETHEME, an URL of a theme.
1818
# export DTC_SITETHEME=https://....zip
@@ -41,7 +41,7 @@ GITHUB_PROJECT_URL=https://github.com/docToolchain/docToolchain
4141
GITHUB_PROJECT_URL_SSH=git@github.com:docToolchain/docToolchain
4242

4343
# Bump this version up if something is changed in the wrapper script
44-
DTCW_VERSION=0.50
44+
DTCW_VERSION=0.51
4545
# Template replaced by the GitHub value upon releasing dtcw
4646
DTCW_GIT_HASH=##DTCW_GIT_HASH##
4747

@@ -88,15 +88,24 @@ main() {
8888

8989
# No install command, so forward call to docToolchain but first we check if
9090
# everything is there.
91+
docker_image_name=""
9192
if [[ ${environment} != docker ]]; then
9293
assert_doctoolchain_installed "${environment}" "${DTC_VERSION}"
9394
assert_java_version_supported
9495

9596
# TODO: what if 'doctoolchain' found by $PATH does not match the one from the local environment?
9697
# The version provided by $DTC_VERSION could be a different one.
98+
else
99+
docker_image_name="doctoolchain/doctoolchain"
100+
if [ "${1}" = "image" ]; then
101+
docker_image_name="${2-}"
102+
shift 2
103+
assert_argument_exists "$@"
104+
fi
105+
echo "Using docker image: ${docker_image_name}"
97106
fi
98107

99-
command=$(build_command "${environment}" "${DTC_VERSION}" "$@")
108+
command=$(build_command "${environment}" "${DTC_VERSION}" "${docker_image_name}" "$@")
100109

101110
[[ "${DTC_HEADLESS}" = true ]] && echo "Using headless mode since there is no (terminal) interaction possible"
102111

@@ -585,7 +594,8 @@ how_to_install_doctoolchain() {
585594
build_command() {
586595
local env=${1}
587596
local version=${2}
588-
shift 2
597+
local docker_image=${3}
598+
shift 3
589599
local cmd
590600
if [ "${env}" = docker ]; then
591601
# TODO: DTC_PROJECT_BRANCH is not passed into the docker environment
@@ -597,7 +607,7 @@ build_command() {
597607

598608
docker_args="run --rm -i --platform linux/amd64 -u $(id -u):$(id -g) --name ${container_name} \
599609
-e DTC_HEADLESS=true -e DTC_SITETHEME -e DTC_PROJECT_BRANCH=${DTC_PROJECT_BRANCH} \
600-
--entrypoint /bin/bash -v '${pwd}:/project' doctoolchain/doctoolchain:v${version}"
610+
--entrypoint /bin/bash -v '${pwd}:/project' ${docker_image}:v${version}"
601611

602612
cmd="docker ${docker_args} -c \"doctoolchain . ${*} ${DTC_OPTS} && exit\""
603613
else

dtcw.bat

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ErrorActionPreference = "Stop"
1818

1919
# See https://github.com/docToolchain/docToolchain/releases for available versions.
2020
# Set DTC_VERSION to "latest" to get the latest, yet unreleased version.
21-
$DTC_VERSION = "3.2.0"
21+
$DTC_VERSION = "3.2.1"
2222
if ($env:DTC_VERSION) { $DTC_VERSION = $env:DTC_VERSION }
2323

2424
#here you can specify the URL of a theme to use with generateSite-task
@@ -45,7 +45,7 @@ $distribution_url = "https://github.com/docToolchain/docToolchain/releases/downl
4545
$GITHUB_PROJECT_URL = "https://github.com/docToolchain/docToolchain"
4646

4747
# Bump this version up if something is changed in the wrapper script
48-
$DTCW_VERSION = "0.52"
48+
$DTCW_VERSION = "0.53"
4949
# Template replaced by the GitHub value upon releasing dtcw
5050
$DTCW_GIT_HASH = "##DTCW_GIT_HASH##"
5151

@@ -100,17 +100,29 @@ function main($_args) {
100100
}
101101
# No install command, so forward call to docToolchain but first we check if
102102
# everything is there.
103+
$docker_image_name = ""
103104
if ($environment -ne "docker")
104105
{
105106
assert_doctoolchain_installed "$environment" "$DTC_VERSION"
106107
assert_java_version_supported
107108
# TODO: what if 'doctoolchain' found by $PATH does not match the one from the local environment?
108109
# The version provided by $DTC_VERSION could be a different one.
110+
} else {
111+
$docker_image_name = "doctoolchain/doctoolchain"
112+
if ( $_args[0] -eq "install" ) {
113+
# shift 1
114+
$null, $_args = $_args
115+
$docker_image_name = $_args[0]
116+
# shift 1
117+
$null, $_args = $_args
118+
assert_argument_exists $_args
119+
}
120+
Write-Output "Using docker image: $docker_image_name"
109121
}
110122
# TODO: can generateDeck, bakePreview be used in combination with other commands?
111123
# The code below assumes we have just one task.
112124

113-
$global:command = build_command "$environment" "$DTC_VERSION" $_args
125+
$global:command = build_command "$environment" "$DTC_VERSION" "$docker_image_name" $_args
114126

115127
#TODO: implement HEADLESS mode
116128
# [[ "${DTC_HEADLESS}" = true ]] && echo "Using headless mode since there is no (terminal) interaction possible"
@@ -550,7 +562,7 @@ Java runtime (major version 11, 14 or 17) installed on your host.
550562
"@
551563
}
552564

553-
function build_command($environment, $version, $_args) {
565+
function build_command($environment, $version, $docker_image, $_args) {
554566
$cmd = ""
555567
if ( $environment -eq "docker") {
556568
if (-not (Invoke-Expression "docker ps")) {
@@ -568,7 +580,7 @@ function build_command($environment, $version, $_args) {
568580

569581
# TODO: DTC_PROJECT_BRANCH is not passed into the docker environment
570582
# See https://github.com/docToolchain/docToolchain/issues/1087
571-
$docker_args = "run --rm -i --name ${container_name} -e DTC_HEADLESS=1 -e DTC_SITETHEME -e DTC_PROJECT_BRANCH=${DTC_PROJECT_BRANCH} --entrypoint /bin/bash -v '${PWD}:/project' doctoolchain/doctoolchain:v${version}"
583+
$docker_args = "run --rm -i --name ${container_name} -e DTC_HEADLESS=1 -e DTC_SITETHEME -e DTC_PROJECT_BRANCH=${DTC_PROJECT_BRANCH} --entrypoint /bin/bash -v '${PWD}:/project' ${docker_image}:v${version}"
572584
$cmd = "$docker_cmd ${docker_args} -c ""doctoolchain . $_args ${DTC_OPTS} && exit "" "
573585

574586
} else {

dtcw.ps1

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ $ErrorActionPreference = "Stop"
99

1010
# See https://github.com/docToolchain/docToolchain/releases for available versions.
1111
# Set DTC_VERSION to "latest" to get the latest, yet unreleased version.
12-
$DTC_VERSION = "3.2.0"
12+
$DTC_VERSION = "3.2.1"
1313
if ($env:DTC_VERSION) { $DTC_VERSION = $env:DTC_VERSION }
1414

1515
#here you can specify the URL of a theme to use with generateSite-task
@@ -36,7 +36,7 @@ $distribution_url = "https://github.com/docToolchain/docToolchain/releases/downl
3636
$GITHUB_PROJECT_URL = "https://github.com/docToolchain/docToolchain"
3737

3838
# Bump this version up if something is changed in the wrapper script
39-
$DTCW_VERSION = "0.52"
39+
$DTCW_VERSION = "0.53"
4040
# Template replaced by the GitHub value upon releasing dtcw
4141
$DTCW_GIT_HASH = "##DTCW_GIT_HASH##"
4242

@@ -91,17 +91,29 @@ function main($_args) {
9191
}
9292
# No install command, so forward call to docToolchain but first we check if
9393
# everything is there.
94+
$docker_image_name = ""
9495
if ($environment -ne "docker")
9596
{
9697
assert_doctoolchain_installed "$environment" "$DTC_VERSION"
9798
assert_java_version_supported
9899
# TODO: what if 'doctoolchain' found by $PATH does not match the one from the local environment?
99100
# The version provided by $DTC_VERSION could be a different one.
101+
} else {
102+
$docker_image_name = "doctoolchain/doctoolchain"
103+
if ( $_args[0] -eq "install" ) {
104+
# shift 1
105+
$null, $_args = $_args
106+
$docker_image_name = $_args[0]
107+
# shift 1
108+
$null, $_args = $_args
109+
assert_argument_exists $_args
110+
}
111+
Write-Output "Using docker image: $docker_image_name"
100112
}
101113
# TODO: can generateDeck, bakePreview be used in combination with other commands?
102114
# The code below assumes we have just one task.
103115

104-
$global:command = build_command "$environment" "$DTC_VERSION" $_args
116+
$global:command = build_command "$environment" "$DTC_VERSION" "$docker_image_name" $_args
105117

106118
#TODO: implement HEADLESS mode
107119
# [[ "${DTC_HEADLESS}" = true ]] && echo "Using headless mode since there is no (terminal) interaction possible"
@@ -541,7 +553,7 @@ Java runtime (major version 11, 14 or 17) installed on your host.
541553
"@
542554
}
543555

544-
function build_command($environment, $version, $_args) {
556+
function build_command($environment, $version, $docker_image, $_args) {
545557
$cmd = ""
546558
if ( $environment -eq "docker") {
547559
if (-not (Invoke-Expression "docker ps")) {
@@ -559,7 +571,7 @@ function build_command($environment, $version, $_args) {
559571

560572
# TODO: DTC_PROJECT_BRANCH is not passed into the docker environment
561573
# See https://github.com/docToolchain/docToolchain/issues/1087
562-
$docker_args = "run --rm -i --name ${container_name} -e DTC_HEADLESS=1 -e DTC_SITETHEME -e DTC_PROJECT_BRANCH=${DTC_PROJECT_BRANCH} --entrypoint /bin/bash -v '${PWD}:/project' doctoolchain/doctoolchain:v${version}"
574+
$docker_args = "run --rm -i --name ${container_name} -e DTC_HEADLESS=1 -e DTC_SITETHEME -e DTC_PROJECT_BRANCH=${DTC_PROJECT_BRANCH} --entrypoint /bin/bash -v '${PWD}:/project' ${docker_image}:v${version}"
563575
$cmd = "$docker_cmd ${docker_args} -c ""doctoolchain . $_args ${DTC_OPTS} && exit "" "
564576

565577
} else {

0 commit comments

Comments
 (0)