Skip to content

Commit 57741c9

Browse files
authored
Update docfx to install a specific version (#35)
1 parent ade1b2a commit 57741c9

6 files changed

Lines changed: 33 additions & 9 deletions

File tree

src/docfx/NOTES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
This feature currently only supports installing the latest published version
2-
of DocFX. If support for older versions are required please file an Issue or
3-
send a pull request.
1+
This feature installs the latest version compatible with Microsoft's internal documentation
2+
platform which is currently 2.67.5. You can install a different version or 'latest" by using
3+
the 'version' option.
44

55
## OS Support
66

src/docfx/devcontainer-feature.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
{
22
"name": "DocFX",
33
"id": "docfx",
4-
"version": "1.0.2",
4+
"version": "2.0.0",
55
"description": "Installs docfx tools",
6+
"options": {
7+
"version": {
8+
"type": "string",
9+
"proposals": [
10+
"latest",
11+
"2.67.5"
12+
],
13+
"default": "2.67.5",
14+
"description": "Select version of DocFX"
15+
}
16+
},
617
"customizations": {
718
"vscode": {
819
"extensions": [

src/docfx/install.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
DOCFX_VERSION=${VERSION:-"2.67.5"}
4+
35
if command -v tdnf >/dev/null 2>&1; then
46
tdnf update
57
tdnf install -y dotnet-sdk-6.0 sudo awk ca-certificates
@@ -22,9 +24,18 @@ fi
2224

2325
if command -v sudo >/dev/null 2>&1; then
2426
if [ "root" != "$_REMOTE_USER" ]; then
25-
sudo -u ${_REMOTE_USER} bash -c "cd ~ && dotnet tool install --global docfx"
26-
exit 0
27+
if [ "latest" == "${DOCFX_VERSION}"]; then
28+
sudo -u ${_REMOTE_USER} bash -c "cd ~ && dotnet tool install --global docfx"
29+
exit 0
30+
else
31+
sudo -u ${_REMOTE_USER} bash -c "cd ~ && dotnet tool install --global docfx --version ${DOCFX_VERSION}"
32+
exit 0
33+
fi
2734
fi
2835
fi
2936

30-
dotnet tool install --global docfx
37+
if [ "latest" == "${DOCFX_VERSION}"]; then
38+
dotnet tool install --global docfx
39+
else
40+
dotnet tool install --global docfx --version ${DOCFX_VERSION}
41+
fi

test/_global/mariner_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ check "no-dirs" grep -v "drwxr" <(ls -l /tmp/mariner_tests)
1111
check "git-config" grep "ado-auth-helper" <(cat /tmp/mariner_tests/.git/config)
1212
check "dotnet" grep "pkgs.dev.azure.com" <(cat /usr/local/bin/run-dotnet.sh)
1313
check "nuget" grep "pkgs.dev.azure.com" <(cat /usr/local/bin/run-nuget.sh)
14+
check "docfx-version" bash -c "docfx --version"
1415

1516
# Report result
1617
# If any of the checks above exited with a non-zero exit code, the test will fail.

test/_global/scenarios.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
"options": "--single-branch --no-src",
5555
"scalar": "true"
5656
},
57-
"artifacts-helper": {}
57+
"artifacts-helper": {},
58+
"docfx": {"version": "latest"}
5859
},
5960
"remoteEnv": {
6061
"EXT_GIT_PAT": "dummypat"

test/docfx/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -e
66
source dev-container-features-test-lib
77

88
# Feature-specific tests
9-
check "version" docfx --version
9+
check "version" bash -c "docfx --version | grep '2.67.5'"
1010

1111
# Report results
1212
# If any of the checks above exited with a non-zero exit code, the test will fail.

0 commit comments

Comments
 (0)