diff --git a/.github/actions/dotnet/action.yml b/.github/actions/dotnet/action.yml deleted file mode 100644 index c876ae3..0000000 --- a/.github/actions/dotnet/action.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: ⚙ dotnet -description: Configures dotnet if the repo/org defines the DOTNET custom property - -runs: - using: composite - steps: - - name: 🔎 dotnet - id: dotnet - shell: bash - run: | - VERSIONS=$(gh api repos/${{ github.repository }}/properties/values | jq -r '.[] | select(.property_name == "DOTNET") | .value') - # Remove extra whitespace from VERSIONS - VERSIONS=$(echo "$VERSIONS" | tr -s ' ' | tr -d ' ') - # Convert comma-separated to newline-separated - NEWLINE_VERSIONS=$(echo "$VERSIONS" | tr ',' '\n') - # Validate versions - while IFS= read -r version; do - if ! [[ $version =~ ^[0-9]+(\.[0-9]+(\.[0-9]+)?)?(\.x)?$ ]]; then - echo "Error: Invalid version format: $version" - exit 1 - fi - done <<< "$NEWLINE_VERSIONS" - # Write multiline output to $GITHUB_OUTPUT - { - echo 'versions<> $GITHUB_OUTPUT - - - name: ⚙ dotnet - if: steps.dotnet.outputs.versions != '' - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - ${{ steps.dotnet.outputs.versions }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6bd793..1733ba3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,8 +21,6 @@ on: env: DOTNET_NOLOGO: true - PackOnBuild: true - GeneratePackageOnBuild: true VersionPrefix: 42.42.${{ github.run_number }} VersionLabel: ${{ github.ref }} GH_TOKEN: ${{ secrets.GH_TOKEN }} @@ -76,6 +74,15 @@ jobs: dotnet tool update -g dotnet-retest dotnet retest -- --no-build + - name: 🙏 publish + shell: pwsh + run: | + $rids = dotnet msbuild src/runfile/runfile.csproj -getproperty:RuntimeIdentifiers + $rids | %{ $_.Split(';') } | %{ $_.Trim() } | ? { $_ } | %{ dotnet publish -r $_ } + + - name: 📦 pack + run: dotnet pack --no-build -m:1 -bl:pack.binlog + - name: 🐛 logs uses: actions/upload-artifact@v4 if: runner.debug && always() diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 03e57d9..cb02898 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,8 +10,6 @@ on: env: DOTNET_NOLOGO: true Configuration: Release - PackOnBuild: true - GeneratePackageOnBuild: true VersionLabel: ${{ github.ref }} GH_TOKEN: ${{ secrets.GH_TOKEN }} MSBUILDTERMINALLOGGER: auto @@ -38,6 +36,15 @@ jobs: dotnet tool update -g dotnet-retest dotnet retest -- --no-build + - name: 🙏 publish + shell: pwsh + run: | + $rids = dotnet msbuild src/runfile/runfile.csproj -getproperty:RuntimeIdentifiers + $rids | %{ $_.Split(';') } | %{ $_.Trim() } | ? { $_ } | %{ dotnet publish -r $_ } + + - name: 📦 pack + run: dotnet pack --no-build -m:1 -bl:pack.binlog + - name: 🐛 logs uses: actions/upload-artifact@v4 if: runner.debug && always() diff --git a/.netconfig b/.netconfig index 616aeb6..2cb6170 100644 --- a/.netconfig +++ b/.netconfig @@ -47,9 +47,7 @@ weak [file ".github/actions/dotnet/action.yml"] url = https://github.com/devlooped/oss/blob/main/.github/actions/dotnet/action.yml - sha = f2b690ce307acb76c5b8d7faec1a5b971a93653e - etag = 27ea11baa2397b3ec9e643a935832da97719c4e44215cfd135c49cad4c29373f - weak + skip [file ".github/dependabot.yml"] url = https://github.com/devlooped/oss/blob/main/.github/dependabot.yml sha = e733294084fb3e75d517a2e961e87df8faae7dc6 diff --git a/changelog.md b/changelog.md index 0656f70..3e6b675 100644 --- a/changelog.md +++ b/changelog.md @@ -1,67 +1,67 @@ # Changelog -## [v0.5.1](https://github.com/devlooped/runcs/tree/v0.5.1) (2025-09-25) +## [v0.5.1](https://github.com/devlooped/runfile/tree/v0.5.1) (2025-09-25) -[Full Changelog](https://github.com/devlooped/runcs/compare/v0.5.0...v0.5.1) +[Full Changelog](https://github.com/devlooped/runfile/compare/v0.5.0...v0.5.1) -## [v0.5.0](https://github.com/devlooped/runcs/tree/v0.5.0) (2025-09-25) +## [v0.5.0](https://github.com/devlooped/runfile/tree/v0.5.0) (2025-09-25) -[Full Changelog](https://github.com/devlooped/runcs/compare/v0.4.0...v0.5.0) +[Full Changelog](https://github.com/devlooped/runfile/compare/v0.4.0...v0.5.0) :sparkles: Implemented enhancements: -- Add support for creating aliases for refs [\#18](https://github.com/devlooped/runcs/pull/18) (@kzu) +- Add support for creating aliases for refs [\#18](https://github.com/devlooped/runfile/pull/18) (@kzu) -## [v0.4.0](https://github.com/devlooped/runcs/tree/v0.4.0) (2025-09-24) +## [v0.4.0](https://github.com/devlooped/runfile/tree/v0.4.0) (2025-09-24) -[Full Changelog](https://github.com/devlooped/runcs/compare/v0.3.1...v0.4.0) +[Full Changelog](https://github.com/devlooped/runfile/compare/v0.3.1...v0.4.0) :sparkles: Implemented enhancements: -- Update to latest .NET 10 which receives the file without 'run' [\#17](https://github.com/devlooped/runcs/pull/17) (@kzu) -- Default to non-AOT for runcs to broaden run-ability [\#15](https://github.com/devlooped/runcs/pull/15) (@kzu) +- Update to latest .NET 10 which receives the file without 'run' [\#17](https://github.com/devlooped/runfile/pull/17) (@kzu) +- Default to non-AOT for runfile to broaden run-ability [\#15](https://github.com/devlooped/runfile/pull/15) (@kzu) :hammer: Other: -- Azure DevOps projects and repos with spaces not supported [\#12](https://github.com/devlooped/runcs/issues/12) +- Azure DevOps projects and repos with spaces not supported [\#12](https://github.com/devlooped/runfile/issues/12) :twisted_rightwards_arrows: Merged: -- Update to latest SLNX format [\#14](https://github.com/devlooped/runcs/pull/14) (@kzu) -- Add support for Azure DevOps projects and repos with spaces [\#13](https://github.com/devlooped/runcs/pull/13) (@alexwiese) +- Update to latest SLNX format [\#14](https://github.com/devlooped/runfile/pull/14) (@kzu) +- Add support for Azure DevOps projects and repos with spaces [\#13](https://github.com/devlooped/runfile/pull/13) (@alexwiese) -## [v0.3.1](https://github.com/devlooped/runcs/tree/v0.3.1) (2025-08-30) +## [v0.3.1](https://github.com/devlooped/runfile/tree/v0.3.1) (2025-08-30) -[Full Changelog](https://github.com/devlooped/runcs/compare/v0.3.0...v0.3.1) +[Full Changelog](https://github.com/devlooped/runfile/compare/v0.3.0...v0.3.1) -## [v0.3.0](https://github.com/devlooped/runcs/tree/v0.3.0) (2025-08-30) +## [v0.3.0](https://github.com/devlooped/runfile/tree/v0.3.0) (2025-08-30) -[Full Changelog](https://github.com/devlooped/runcs/compare/v0.2.0...v0.3.0) +[Full Changelog](https://github.com/devlooped/runfile/compare/v0.2.0...v0.3.0) :sparkles: Implemented enhancements: -- Unify implementation across gist/runcs [\#7](https://github.com/devlooped/runcs/pull/7) (@kzu) -- Add support for downloading and running Azure DevOps too [\#6](https://github.com/devlooped/runcs/pull/6) (@kzu) +- Unify implementation across gist/runfile [\#7](https://github.com/devlooped/runfile/pull/7) (@kzu) +- Add support for downloading and running Azure DevOps too [\#6](https://github.com/devlooped/runfile/pull/6) (@kzu) -## [v0.2.0](https://github.com/devlooped/runcs/tree/v0.2.0) (2025-08-29) +## [v0.2.0](https://github.com/devlooped/runfile/tree/v0.2.0) (2025-08-29) -[Full Changelog](https://github.com/devlooped/runcs/compare/v0.1.2...v0.2.0) +[Full Changelog](https://github.com/devlooped/runfile/compare/v0.1.2...v0.2.0) -## [v0.1.2](https://github.com/devlooped/runcs/tree/v0.1.2) (2025-08-28) +## [v0.1.2](https://github.com/devlooped/runfile/tree/v0.1.2) (2025-08-28) -[Full Changelog](https://github.com/devlooped/runcs/compare/v0.1.1...v0.1.2) +[Full Changelog](https://github.com/devlooped/runfile/compare/v0.1.1...v0.1.2) -## [v0.1.1](https://github.com/devlooped/runcs/tree/v0.1.1) (2025-08-28) +## [v0.1.1](https://github.com/devlooped/runfile/tree/v0.1.1) (2025-08-28) -[Full Changelog](https://github.com/devlooped/runcs/compare/v0.1.0...v0.1.1) +[Full Changelog](https://github.com/devlooped/runfile/compare/v0.1.0...v0.1.1) :sparkles: Implemented enhancements: -- Fail if explicit gist file path not found [\#3](https://github.com/devlooped/runcs/pull/3) (@kzu) +- Fail if explicit gist file path not found [\#3](https://github.com/devlooped/runfile/pull/3) (@kzu) -## [v0.1.0](https://github.com/devlooped/runcs/tree/v0.1.0) (2025-08-28) +## [v0.1.0](https://github.com/devlooped/runfile/tree/v0.1.0) (2025-08-28) -[Full Changelog](https://github.com/devlooped/runcs/compare/ce016575c85c447e1ebc5d2fa109908c92d89f5d...v0.1.0) +[Full Changelog](https://github.com/devlooped/runfile/compare/ce016575c85c447e1ebc5d2fa109908c92d89f5d...v0.1.0) diff --git a/readme.md b/readme.md index c8ba5cf..0f541a4 100644 --- a/readme.md +++ b/readme.md @@ -1,18 +1,18 @@ -![Icon](https://raw.githubusercontent.com/devlooped/runcs/main/assets/img/icon-32.png) dnx runcs +![Icon](https://raw.githubusercontent.com/devlooped/runfile/main/assets/img/icon-32.png) dnx runfile ============ -[![Version](https://img.shields.io/nuget/vpre/runcs.svg?color=royalblue)](https://www.nuget.org/packages/runcs) -[![Downloads](https://img.shields.io/nuget/dt/runcs.svg?color=green)](https://www.nuget.org/packages/runcs) -[![License](https://img.shields.io/github/license/devlooped/runcs.svg?color=blue)](https://github.com/devlooped/runcs/blob/main/license.txt) -[![Build](https://github.com/devlooped/runcs/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/devlooped/runcs/actions/workflows/build.yml) +[![Version](https://img.shields.io/nuget/vpre/runfile.svg?color=royalblue)](https://www.nuget.org/packages/runfile) +[![Downloads](https://img.shields.io/nuget/dt/runfile.svg?color=green)](https://www.nuget.org/packages/runfile) +[![License](https://img.shields.io/github/license/devlooped/runfile.svg?color=blue)](https://github.com/devlooped/runfile/blob/main/license.txt) +[![Build](https://github.com/devlooped/runfile/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/devlooped/runfile/actions/workflows/build.yml) -## dnx runcs - +## dnx runfile + Run C# code programs from git repos on GitHub, GitLab and Azure DevOps. ``` Usage: - [dnx] runcs [--aot] [--alias ALIAS] [...] + [dnx] runfile [--aot] [--alias ALIAS] [...] Arguments: Reference to remote file to run, with format [host/]owner/repo[@ref][:path] @@ -37,10 +37,10 @@ Options: Example: ``` -dnx runcs kzu/runcs@v1:run.cs dotnet rocks +dnx runfile kzu/runfile@v1:run.cs dotnet rocks ``` -View [source](https://github.com/kzu/runcs/blob/v1/run.cs): +View [source](https://github.com/kzu/runfile/blob/v1/run.cs): ```csharp #:package Spectre.Console@* @@ -57,7 +57,7 @@ AnsiConsole.MarkupLine($"Hello world from [green]dnx[/] [yellow]gist[/] :rocket: When running different files from the same repo+ref, the download will be performed only once. The last download etag is used to avoid downloading on each run. - + ## dnx gist diff --git a/runcs.slnx b/runfile.slnx similarity index 75% rename from runcs.slnx rename to runfile.slnx index 9dc4b81..64f5d34 100644 --- a/runcs.slnx +++ b/runfile.slnx @@ -1,6 +1,6 @@ - + diff --git a/src/Core/RemoteRefExtensions.cs b/src/Core/RemoteRefExtensions.cs index c0ad69f..bdda884 100644 --- a/src/Core/RemoteRefExtensions.cs +++ b/src/Core/RemoteRefExtensions.cs @@ -11,7 +11,7 @@ public static class RemoteRefExtensions public string EnsureTempPath() => Directory.CreateUserDirectory(location.TempPath); } - /// Obtains the temporary directory root, e.g., /tmp/dotnet/runcs/. + /// Obtains the temporary directory root, e.g., /tmp/dotnet/runfile/. static string GetTempRoot() { // We want a location where permissions are expected to be restricted to the current user. @@ -19,9 +19,9 @@ static string GetTempRoot() ? Path.GetTempPath() : Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); - return Directory.CreateUserDirectory(Path.Join(directory, "dotnet", "runcs")); + return Directory.CreateUserDirectory(Path.Join(directory, "dotnet", "runfile")); } - /// Obtains a specific temporary path in a subdirectory of the temp root, e.g., /tmp/dotnet/runcs/{name}. + /// Obtains a specific temporary path in a subdirectory of the temp root, e.g., /tmp/dotnet/runfile/{name}. public static string GetTempSubpath(params string[] name) => Directory.CreateUserDirectory(Path.Join([GetTempRoot(), .. name])); } diff --git a/src/Directory.props b/src/Directory.props index 962ee0d..b43ee9f 100644 --- a/src/Directory.props +++ b/src/Directory.props @@ -5,7 +5,7 @@ false Preview https://api.nuget.org/v3/index.json;https://pkg.kzu.app/index.json - runcs + runfile diff --git a/src/Tests/DownloadTests.cs b/src/Tests/DownloadTests.cs index 4e86699..7cfd898 100644 --- a/src/Tests/DownloadTests.cs +++ b/src/Tests/DownloadTests.cs @@ -6,23 +6,23 @@ public class DownloadTests { [LocalTheory] // Requires being authenticated with private kzu's GH repo - [InlineData("github.com/kzu/runcs")] - [InlineData("github.com/kzu/runcs@v0.1.0")] - [InlineData("github.com/kzu/runcs@dev")] - [InlineData("github.com/kzu/runcs@211de7614553152d848ef53dd9587d1a52c76582")] - [InlineData("github.com/kzu/runcs@211de7614")] - [InlineData("github.com/kzu/runcs@211de761455")] + [InlineData("github.com/kzu/runfile")] + [InlineData("github.com/kzu/runfile@v0.1.0")] + [InlineData("github.com/kzu/runfile@dev")] + [InlineData("github.com/kzu/runfile@211de7614553152d848ef53dd9587d1a52c76582")] + [InlineData("github.com/kzu/runfile@211de7614")] + [InlineData("github.com/kzu/runfile@211de761455")] // Requires running the CLI app once against this private repo and saving a PAT - [InlineData("gitlab.com/kzu/runcs")] - [InlineData("gitlab.com/kzu/runcs@v0.1.0")] - [InlineData("gitlab.com/kzu/runcs@dev")] - [InlineData("gitlab.com/kzu/runcs@533ecac61d4cf62dac0c72567e73753acd235ac2")] - [InlineData("gitlab.com/kzu/runcs@533ecac61")] - [InlineData("gitlab.com/kzu/runcs@533ecac61d4")] + [InlineData("gitlab.com/kzu/runfile")] + [InlineData("gitlab.com/kzu/runfile@v0.1.0")] + [InlineData("gitlab.com/kzu/runfile@dev")] + [InlineData("gitlab.com/kzu/runfile@533ecac61d4cf62dac0c72567e73753acd235ac2")] + [InlineData("gitlab.com/kzu/runfile@533ecac61")] + [InlineData("gitlab.com/kzu/runfile@533ecac61d4")] // Also private auth - //[InlineData("bitbucket.org/kzu/runcs")] - //[InlineData("bitbucket.org/kzu/runcs@v0.1.0")] - //[InlineData("bitbucket.org/kzu/runcs@dev")] + //[InlineData("bitbucket.org/kzu/runfile")] + //[InlineData("bitbucket.org/kzu/runfile@v0.1.0")] + //[InlineData("bitbucket.org/kzu/runfile@dev")] public async Task DownloadPrivateUnchanged(string value) { Assert.True(RemoteRef.TryParse(value, out var location)); diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index 074f6fe..ee4129a 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -7,18 +7,12 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + @@ -41,7 +35,7 @@ - + diff --git a/src/gist/Program.cs b/src/gist/Program.cs index 47821eb..0ce9a70 100644 --- a/src/gist/Program.cs +++ b/src/gist/Program.cs @@ -18,7 +18,7 @@ } var config = Config.Build(Config.GlobalLocation); -if (args.Length > 0 && config.GetString("runcs", args[0]) is string aliased) +if (args.Length > 0 && config.GetString("runfile", args[0]) is string aliased) args = [aliased, .. args[1..]]; // Set alias and remove from args if present @@ -56,7 +56,7 @@ Can be an alias previously set with --alias. } if (alias != null) - config = config.SetString("runcs", alias, location.ToString()); + config = config.SetString("runfile", alias, location.ToString()); // Create the dispatcher on the main thread. This is required // for some platform UI services such as macOS that mandates diff --git a/src/gist/gist.csproj b/src/gist/gist.csproj index 605a18f..a66d448 100644 --- a/src/gist/gist.csproj +++ b/src/gist/gist.csproj @@ -7,12 +7,23 @@ Devlooped gist + Run C# code gists directly using: dnx gist owner/gist[:path] + gist true readme.md dotnet dotnet-tool - Run C# code gists directly using: dnx gist owner/gist[:path] + win-x64 + + linux-x64; + linux-arm64; + osx-arm64; + osx-x64; + win-x64; + win-arm64 + + false diff --git a/src/runcs/Program.cs b/src/runfile/Program.cs similarity index 95% rename from src/runcs/Program.cs rename to src/runfile/Program.cs index 7c3d860..be97548 100644 --- a/src/runcs/Program.cs +++ b/src/runfile/Program.cs @@ -18,7 +18,7 @@ } var config = Config.Build(Config.GlobalLocation); -if (args.Length > 0 && config.GetString("runcs", args[0]) is string aliased) +if (args.Length > 0 && config.GetString("runfile", args[0]) is string aliased) args = [aliased, .. args[1..]]; // Set alias and remove from args if present @@ -58,7 +58,7 @@ Can be an alias previously set with --alias. } if (alias != null) - config = config.SetString("runcs", alias, location.ToString()); + config = config.SetString("runfile", alias, location.ToString()); // Create the dispatcher on the main thread. This is required // for some platform UI services such as macOS that mandates diff --git a/src/runcs/Properties/launchSettings.json b/src/runfile/Properties/launchSettings.json similarity index 63% rename from src/runcs/Properties/launchSettings.json rename to src/runfile/Properties/launchSettings.json index ede11a3..82b8d52 100644 --- a/src/runcs/Properties/launchSettings.json +++ b/src/runfile/Properties/launchSettings.json @@ -5,23 +5,23 @@ }, "args": { "commandName": "Project", - "commandLineArgs": "--aot kzu/runcs@v1 dotnet rocks" + "commandLineArgs": "--aot kzu/runfile@v1 dotnet rocks" }, "github": { "commandName": "Project", - "commandLineArgs": "kzu/runcs@main:program.cs" + "commandLineArgs": "kzu/runfile@main:program.cs" }, "gitlab": { "commandName": "Project", - "commandLineArgs": "gitlab.com/kzu/runcs@main:program.cs" + "commandLineArgs": "gitlab.com/kzu/runfile" }, "devops": { "commandName": "Project", - "commandLineArgs": "dev.azure.com/kzu/runcs/runcs@77d857042555c4e60afdb6c41256b2820d6ca14c" + "commandLineArgs": "dev.azure.com/kzu/runfile/runfile@77d857042555c4e60afdb6c41256b2820d6ca14c" }, "bitbucket": { "commandName": "Project", - "commandLineArgs": "bitbucket.org/kzu/runcs@dev:program.cs" + "commandLineArgs": "bitbucket.org/kzu/runfile@dev:program.cs" }, "vault2secrets": { "commandName": "Project", diff --git a/src/runcs/readme.md b/src/runfile/readme.md similarity index 95% rename from src/runcs/readme.md rename to src/runfile/readme.md index 0c60ce0..140a612 100644 --- a/src/runcs/readme.md +++ b/src/runfile/readme.md @@ -1,10 +1,10 @@ - - + + Run C# code programs from git repos on GitHub, GitLab and Azure DevOps. ``` Usage: - [dnx] runcs [--aot] [--alias ALIAS] [...] + [dnx] runfile [--aot] [--alias ALIAS] [...] Arguments: Reference to remote file to run, with format [host/]owner/repo[@ref][:path] @@ -29,10 +29,10 @@ Options: Example: ``` -dnx runcs kzu/runcs@v1:run.cs dotnet rocks +dnx runfile kzu/runfile@v1:run.cs dotnet rocks ``` -View [source](https://github.com/kzu/runcs/blob/v1/run.cs): +View [source](https://github.com/kzu/runfile/blob/v1/run.cs): ```csharp #:package Spectre.Console@* @@ -49,8 +49,8 @@ AnsiConsole.MarkupLine($"Hello world from [green]dnx[/] [yellow]gist[/] :rocket: When running different files from the same repo+ref, the download will be performed only once. The last download etag is used to avoid downloading on each run. - - + + # Sponsors diff --git a/src/runcs/runcs.csproj b/src/runfile/runfile.csproj similarity index 75% rename from src/runcs/runcs.csproj rename to src/runfile/runfile.csproj index a2f7d87..0725d13 100644 --- a/src/runcs/runcs.csproj +++ b/src/runfile/runfile.csproj @@ -3,26 +3,39 @@ Exe net10.0 - runcs + runfile Devlooped - runcs - runcs + runfile + Run C# code from remote locations using: dnx runfile [host/]owner/repo[@ref][:path] + + runfile true readme.md dotnet dotnet-tool - Run C# code from remote locations using: dnx runcs [host/]owner/repo[@ref][:path] + win-x64 + + linux-x64; + linux-arm64; + osx-arm64; + osx-x64; + win-x64; + win-arm64 + + false + + - +