diff --git a/src/typst/devcontainer-feature.json b/src/typst/devcontainer-feature.json index 874bd40c0..ea59c0fb4 100644 --- a/src/typst/devcontainer-feature.json +++ b/src/typst/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "typst", - "version": "1.0.6", + "version": "1.0.7", "name": "Typst (via Github Releases)", "documentationURL": "http://github.com/devcontainers-extra/features/tree/main/src/typst", "description": "Typst is a new markup-based typesetting system that is designed to be as powerful as LaTeX while being much easier to learn and use.", diff --git a/src/typst/install.sh b/src/typst/install.sh index a97a9e797..dbe344b05 100755 --- a/src/typst/install.sh +++ b/src/typst/install.sh @@ -10,14 +10,34 @@ set -e # of the script ensure_nanolayer nanolayer_location "v0.5.4" +# detect architecture +architecture="$(uname -m)" +case ${architecture} in + x86_64 | amd64) + arch="x86_64" + ;; + aarch64 | arm64) + arch="aarch64" + ;; + *) + echo "(!) Architecture ${architecture} is not supported by the typst feature" + exit 1 + ;; +esac + +# target expected release asset via arch-driven release triple +asset_regex="^typst-${arch}-unknown-linux-(gnu|musl)\\.tar\\.(gz|xz)$" + +# only consider stable "vX.Y.Z" tags +# pre-release tags (v0.15.0-rc.1) and legacy date based tags (v23-03-28) are deliberately ignored +release_tag_regex='^v[0-9]+\.[0-9]+\.[0-9]+$' $nanolayer_location \ install \ devcontainer-feature \ "ghcr.io/devcontainers-extra/features/gh-release:1.0.25" \ - --option repo='typst/typst' --option binaryNames='typst' --option version="$VERSION" + --option repo='typst/typst' --option binaryNames='typst' --option version="$VERSION" --option assetRegex="$asset_regex" --option releaseTagRegex="$release_tag_regex" echo 'Done!' - diff --git a/test/typst/scenarios.json b/test/typst/scenarios.json index 39aafc202..611b88125 100644 --- a/test/typst/scenarios.json +++ b/test/typst/scenarios.json @@ -4,5 +4,13 @@ "features": { "typst": {} } + }, + "test_specific_version": { + "image": "mcr.microsoft.com/devcontainers/base:debian", + "features": { + "typst": { + "version": "0.13.0" + } + } } -} \ No newline at end of file +} diff --git a/test/typst/test_specific_version.sh b/test/typst/test_specific_version.sh new file mode 100755 index 000000000..a5b5da665 --- /dev/null +++ b/test/typst/test_specific_version.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +source dev-container-features-test-lib + +check "typst version is equal to 0.13.0" sh -c "typst --version | grep '0.13.0'" + +reportResults