diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml
new file mode 100644
index 00000000..62268c83
--- /dev/null
+++ b/.github/workflows/publish-release.yml
@@ -0,0 +1,35 @@
+name: Publish Release
+on:
+ push:
+ tags:
+ - "v*.*.*"
+
+jobs:
+ release:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-java@v3
+ with:
+ distribution: temurin
+ java-version: 17
+ - name: Setup Gradle
+ uses: gradle/gradle-build-action@v2
+
+ - name: Build CLI
+ run: ./gradlew --no-daemon :cli:shadowDistZip :cli:shadowDistTar
+
+ - name: Rename cli-shadow to cli
+ run: |
+ mv cli/build/distributions/cli-shadow.zip cli/build/distributions/cli.zip
+ mv cli/build/distributions/cli-shadow.tar cli/build/distributions/cli.tar
+
+ - name: Release
+ uses: softprops/action-gh-release@v1
+ with:
+ files: |
+ cli/build/distributions/cli.zip
+ cli/build/distributions/cli.tar
+ fail_on_unmatched_files: true
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..a72105f7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,65 @@
+
SAMT - Simple API Modeling Toolkit
+
+
+
+[](https://github.com/samtkit/core/releases/latest)
+[](https://github.com/samtkit/core/releases/latest)
+[](./LICENSE)
+
+
+
+
+ Tired of unreadable OpenAPI YAML files and a plethora of different tools?
+
SAMT is a developer-focused, extendable and easy-to-learn toolkit for modeling APIs using a business-first approach
+
+
+
+
+
+## Documentation
+
+Get started with SAMT, learn fundamental concepts or extend SAMT with a custom generator.
+
+- [Getting Started](https://github.com/samtkit/core/wiki/Getting-Started)
+- [Modeling Concepts](https://github.com/samtkit/core/wiki/Modeling-Concepts)
+- [Visual Studio Code Plugin](https://marketplace.visualstudio.com/items?itemName=samt.samt)
+
+### Advanced
+
+- [Authoring Generators](https://github.com/samtkit/core/wiki/Authoring-Generators)
+- [Architecture](https://github.com/samtkit/core/wiki/Architecture)
+
+## Development Setup
+
+SAMT is written in [Kotlin](https://kotlinlang.org/) and uses [Gradle](https://gradle.org/) as a build tool, for the best developer experience we recommend using [IntelliJ](https://www.jetbrains.com/idea/).
+
+If you want to start SAMT locally, simply clone the repository and compile it using Gradle:
+
+```shell
+./gradlew assemble
+```
+
+You can also compile the CLI module locally:
+
+```shell
+./gradlew :cli:shadowJar
+```
+
+And then compile SAMT files using this locally compiled version:
+
+```shell
+java -jar ./cli/build/libs/samt-cli.jar ./specification/examples/todo-service/*.samt
+```
+
+If you're more interested in the [SAMT Visual Studio Code plugin](https://github.com/samtkit/vscode) or the related language server, you can also compile it locally as well:
+
+```shell
+./gradlew :language-server:shadowJar
+```
+
+## Contributing
+
+Want to report a bug, contribute code, or improve documentation? Excellent!
+Simply create an [issue](https://github.com/samtkit/core/issues),
+open a [pull request](https://github.com/samtkit/core/pulls) or
+start a [discussion](https://github.com/samtkit/core/discussions).
diff --git a/cli/src/main/kotlin/tools/samt/cli/App.kt b/cli/src/main/kotlin/tools/samt/cli/App.kt
index e0755852..e9a03b43 100644
--- a/cli/src/main/kotlin/tools/samt/cli/App.kt
+++ b/cli/src/main/kotlin/tools/samt/cli/App.kt
@@ -12,7 +12,7 @@ fun main(args: Array) {
val cliArgs = CliArgs()
val jCommander = JCommander.newBuilder()
.addObject(cliArgs)
- .programName("java -jar samt-cli.jar")
+ .programName("./samtw")
.build()
jCommander.parse(*args)
if (cliArgs.help) {
diff --git a/wrapper/samt-wrapper.properties b/wrapper/samt-wrapper.properties
new file mode 100644
index 00000000..93ea14f5
--- /dev/null
+++ b/wrapper/samt-wrapper.properties
@@ -0,0 +1,2 @@
+samtVersion=v0.0.1
+distributionUrl=https\://github.com/samtkit/core/releases/download/$samtVersion/cli.tar
diff --git a/wrapper/samtw b/wrapper/samtw
new file mode 100755
index 00000000..ddf27724
--- /dev/null
+++ b/wrapper/samtw
@@ -0,0 +1,42 @@
+#!/usr/bin/env sh
+
+if [ ! -f ./samt-wrapper.properties ]; then
+ echo "samt-wrapper.properties file not found." >&2
+ exit 1
+fi
+
+. ./samt-wrapper.properties
+
+if ! command -v tar > /dev/null; then
+ echo "This script requires 'tar' to be installed." >&2
+ exit 1
+fi
+
+mkdir -p .samt/cli
+
+if [ ! -f .samt/.gitignore ]; then
+ echo "*" > .samt/.gitignore
+fi
+
+currentVersion=$(cat .samt/cli/version.txt 2> /dev/null || echo "0.0.0")
+
+if [ "$currentVersion" != "$samtVersion" ]; then
+ echo "Downloading samt $samtVersion from '$distributionUrl'..."
+ if command -v curl > /dev/null; then
+ if ! curl -s -L "$distributionUrl" | tar x -C .samt/cli; then
+ echo "An error occurred while downloading '$distributionUrl' archive using curl." >&2
+ exit 1
+ fi
+ echo "$samtVersion" > .samt/cli/version.txt
+ elif command -v curl > /dev/null; then
+ if ! wget -qO- "$distributionUrl" | tar x -C .samt/cli; then
+ echo "An error occurred while downloading '$distributionUrl' archive using wget." >&2
+ exit 1
+ fi
+ else
+ echo "samtw requires either 'curl' or 'wget' to be installed." >&2
+ exit 1
+ fi
+fi
+
+exec ".samt/cli/cli-shadow/bin/cli" "$@"
diff --git a/wrapper/samtw.bat b/wrapper/samtw.bat
new file mode 100644
index 00000000..5830d87b
--- /dev/null
+++ b/wrapper/samtw.bat
@@ -0,0 +1,59 @@
+@echo off
+
+setlocal EnableDelayedExpansion
+
+if not exist samt-wrapper.properties (
+ echo "samt-wrapper.properties not found."
+ exit /b 1
+)
+
+for /f "tokens=1,2 delims==" %%G in (samt-wrapper.properties) do (
+ if "%%G"=="samtVersion" (
+ set "samtVersion=%%H"
+ )
+ if "%%G"=="distributionUrl" (
+ set distributionUrlPattern=%%H
+ )
+)
+
+set distributionUrl=%distributionUrlPattern:$samtVersion=!samtVersion!%
+set distributionUrl=%distributionUrl:\:=:%
+
+where tar >nul || (
+ echo "This script requires 'tar' to be installed." >&2
+ exit /b 1
+)
+
+if not exist .samt\cli mkdir .samt\cli
+
+if not exist .samt\.gitignore echo *> .samt\.gitignore
+
+set "currentVersion=0.0.0"
+
+if exist .samt\cli\version.txt (
+ set /p currentVersion=<.samt\cli\version.txt
+)
+
+if "%currentVersion%" neq "%samtVersion%" (
+ echo Downloading samt %samtVersion% from '%distributionUrl%'...
+ WHERE /q curl
+ if %ERRORLEVEL% EQU 0 (
+ curl -L -o .samt\cli\cli.tar "%distributionUrl%" || (
+ echo An error occurred while downloading '%distributionUrl%' archive using curl. >&2
+ exit /b 1
+ )
+
+ ) else (
+ echo samtw requires 'curl' to be installed. >&2
+ exit /b 1
+ )
+
+ tar xf .samt\cli\cli.tar -C .samt\cli || (
+ echo An error occurred while unpacking .samt\cli\cli.tar using tar. >&2
+ exit /b 1
+ )
+
+ echo %samtVersion%> .samt\cli\version.txt
+)
+
+call ".samt\cli\cli-shadow\bin\cli.bat" %*