From e1ed688d7976dd3d977978a0bc5176e7555dd5ee Mon Sep 17 00:00:00 2001 From: Raymen Scholten Date: Mon, 15 Sep 2025 13:55:43 +0200 Subject: [PATCH 1/6] Add `Clawback` transaction type to `TransactionType` class A new `TransactionType` named `Clawback` was introduced, allowing an issuer to reclaim funds from an account. It is defined with an ordinal value of `30`. This addition includes a descriptive comment explaining its purpose and aligns with the existing pattern of defining transaction types with unique ordinal values. --- Base/Xrpl.BinaryCodec/Enums/TransactionType.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Base/Xrpl.BinaryCodec/Enums/TransactionType.cs b/Base/Xrpl.BinaryCodec/Enums/TransactionType.cs index 928a15c2..ad77313e 100644 --- a/Base/Xrpl.BinaryCodec/Enums/TransactionType.cs +++ b/Base/Xrpl.BinaryCodec/Enums/TransactionType.cs @@ -80,6 +80,12 @@ private static TransactionType Add(string name, int ordinal) public static readonly TransactionType NFTokenCancelOffer = Add(nameof(NFTokenCancelOffer), 28); /// This transaction accepts an existing offer to buy or sell an existing NFT. public static readonly TransactionType NFTokenAcceptOffer = Add(nameof(NFTokenAcceptOffer), 29); + + /// + /// This transaction allows an issuer to reclaim funds from an account. + /// + public static readonly TransactionType Clawback = Add(nameof(Clawback), 30); + public static readonly TransactionType NFTokenModify = Add(nameof(NFTokenModify), 61); public static readonly TransactionType AMMCreate = Add(nameof(AMMCreate), 35); @@ -89,6 +95,7 @@ private static TransactionType Add(string name, int ordinal) public static readonly TransactionType AMMBid = Add(nameof(AMMBid), 39); public static readonly TransactionType AMMDelete = Add(nameof(AMMDelete), 40); + // ... /// /// This system-generated transaction type is used to update the status of the various amendments.
From 9d07abc1eb8309e6999efce5f70452bdac3398cd Mon Sep 17 00:00:00 2001 From: Raymen Scholten Date: Mon, 15 Sep 2025 14:00:03 +0200 Subject: [PATCH 2/6] Add GitHub Actions workflow for NuGet package publishing Documented and automated NuGet package publishing: - Added detailed instructions in `README.md` for using the workflow, setting up GitHub Packages, and optionally configuring NuGet.org. - Introduced `publish-packages.yml` workflow to automate: 1. Version extraction from release tags. 2. Dependency restoration, build, and testing. 3. Package creation and publishing to GitHub Packages. 4. Optional publishing to NuGet.org using `NUGET_API_KEY`. - Provided `nuget.config` example for consuming GitHub Packages. - Included instructions for monitoring workflow execution in GitHub Actions. --- .github/workflows/README.md | 88 ++++++++++++++++++++++++ .github/workflows/publish-packages.yml | 95 ++++++++++++++++++++++++++ 2 files changed, 183 insertions(+) create mode 100644 .github/workflows/README.md create mode 100644 .github/workflows/publish-packages.yml diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 00000000..464d2de8 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,88 @@ +# GitHub Package Publishing Workflow + +This repository includes a GitHub Actions workflow that automatically publishes NuGet packages to GitHub Packages (and optionally to NuGet.org) when a new release is created. + +## How it works + +The workflow is triggered when: +- A new release is created on GitHub + +## What it does + +1. **Extracts version from release tag** - The version is automatically extracted from the Git tag +2. **Sets up .NET environment** - Installs .NET 6, 7, 8, and 9 +3. **Restores dependencies** - Downloads all required NuGet packages +4. **Builds the solution** - Compiles all projects in Release configuration +5. **Runs tests** - Executes all unit tests to ensure quality +6. **Updates package versions** - Sets the package version to match the release tag +7. **Creates NuGet packages** - Packs the following projects: + - Xrpl.AddressCodec + - Xrpl.BinaryCodec + - Xrpl.Keypairs + - Xrpl (main package) +8. **Publishes packages** - Uploads packages to GitHub Packages and optionally to NuGet.org + +## Setup Instructions + +### 1. GitHub Packages (Automatic) +No additional setup required. The workflow uses the built-in `GITHUB_TOKEN` which has the necessary permissions. + +### 2. NuGet.org (Optional) +To also publish to NuGet.org: + +1. Go to your repository's **Settings** ? **Secrets and variables** ? **Actions** +2. Click **New repository secret** +3. Name: `NUGET_API_KEY` +4. Value: Your NuGet.org API key + - Get your API key from [nuget.org/account/apikeys](https://www.nuget.org/account/apikeys) + - Create a new key with "Push new packages and package versions" scope + +## Creating a Release + +1. Go to your repository on GitHub +2. Click **Releases** ? **Create a new release** +3. Create a new tag (e.g., `v1.0.0`, `2.1.0`, etc.) +4. Fill in the release title and description +5. Click **Publish release** + +The workflow will automatically trigger and publish your packages! + +## Package Locations + +### GitHub Packages +Packages will be available at: +- `https://nuget.pkg.github.com/YOUR_USERNAME/index.json` + +### NuGet.org (if configured) +Packages will be available at: +- `https://www.nuget.org/packages/Xrpl.AddressCodec/` +- `https://www.nuget.org/packages/Xrpl.BinaryCodec/` +- `https://www.nuget.org/packages/Xrpl.Keypairs/` +- `https://www.nuget.org/packages/Xrpl/` + +## Using GitHub Packages + +To use packages from GitHub Packages, add this to your `nuget.config`: + +```xml + + + + + + + + + + + + +``` + +## Workflow File Location + +The workflow is located at: `.github/workflows/publish-packages.yml` + +## Monitoring + +You can monitor the workflow execution in the **Actions** tab of your repository. Each release will create a new workflow run that you can view for logs and status. \ No newline at end of file diff --git a/.github/workflows/publish-packages.yml b/.github/workflows/publish-packages.yml new file mode 100644 index 00000000..1d664310 --- /dev/null +++ b/.github/workflows/publish-packages.yml @@ -0,0 +1,95 @@ +name: Publish NuGet Packages + +on: + release: + types: [created] + +env: + DOTNET_NOLOGO: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 7.0.x + 8.0.x + 9.0.x + + - name: Extract version from tag + id: extract_version + run: | + VERSION=${GITHUB_REF#refs/tags/} + # Remove 'v' prefix if present + VERSION=${VERSION#v} + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Extracted version: $VERSION" + + - name: Restore dependencies + run: dotnet restore + + - name: Build solution + run: dotnet build --configuration Release --no-restore + + - name: Run tests + run: dotnet test --configuration Release --no-build --verbosity normal + + - name: Update package versions + run: | + VERSION=${{ steps.extract_version.outputs.version }} + echo "Updating package versions to $VERSION" + + # Update all project files with the new version + sed -i "s/.*<\/PackageVersion>/$VERSION<\/PackageVersion>/g" Base/Xrpl.AddressCodec/Xrpl.AddressCodec.csproj + sed -i "s/.*<\/PackageVersion>/$VERSION<\/PackageVersion>/g" Base/Xrpl.BinaryCodec/Xrpl.BinaryCodec.csproj + sed -i "s/.*<\/PackageVersion>/$VERSION<\/PackageVersion>/g" Base/Xrpl.Keypairs/Xrpl.Keypairs.csproj + sed -i "s/.*<\/PackageVersion>/$VERSION<\/PackageVersion>/g" Xrpl/Xrpl.csproj + + - name: Pack Xrpl.AddressCodec + run: dotnet pack Base/Xrpl.AddressCodec/Xrpl.AddressCodec.csproj --configuration Release --no-build --output ./packages + + - name: Pack Xrpl.BinaryCodec + run: dotnet pack Base/Xrpl.BinaryCodec/Xrpl.BinaryCodec.csproj --configuration Release --no-build --output ./packages + + - name: Pack Xrpl.Keypairs + run: dotnet pack Base/Xrpl.Keypairs/Xrpl.Keypairs.csproj --configuration Release --no-build --output ./packages + + - name: Pack Xrpl + run: dotnet pack Xrpl/Xrpl.csproj --configuration Release --no-build --output ./packages + + - name: List packages + run: ls -la ./packages/ + + - name: Publish to GitHub Packages + run: | + for package in ./packages/*.nupkg; do + echo "Publishing $package" + dotnet nuget push "$package" \ + --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ + --api-key ${{ secrets.GITHUB_TOKEN }} \ + --skip-duplicate + done + + - name: Publish to NuGet.org (if token is available) + if: ${{ secrets.NUGET_API_KEY != '' }} + run: | + for package in ./packages/*.nupkg; do + echo "Publishing $package to NuGet.org" + dotnet nuget push "$package" \ + --source https://api.nuget.org/v3/index.json \ + --api-key ${{ secrets.NUGET_API_KEY }} \ + --skip-duplicate + done \ No newline at end of file From 5cc6c50132cc219a817c43e4edb6256655a42566 Mon Sep 17 00:00:00 2001 From: Raymen Scholten Date: Mon, 15 Sep 2025 14:03:23 +0200 Subject: [PATCH 3/6] Expand NuGet API key check to include vars context Updated the condition for publishing to NuGet.org to check for the `NUGET_API_KEY` in both the `vars` and `secrets` contexts. This change increases flexibility by allowing the API key to be sourced from reusable variables (`vars`) or secrets, making the workflow more adaptable to different configurations. --- .github/workflows/publish-packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-packages.yml b/.github/workflows/publish-packages.yml index 1d664310..1539d4a9 100644 --- a/.github/workflows/publish-packages.yml +++ b/.github/workflows/publish-packages.yml @@ -84,7 +84,7 @@ jobs: done - name: Publish to NuGet.org (if token is available) - if: ${{ secrets.NUGET_API_KEY != '' }} + if: ${{ vars.NUGET_API_KEY != '' || secrets.NUGET_API_KEY != '' }} run: | for package in ./packages/*.nupkg; do echo "Publishing $package to NuGet.org" From 4c014f47df829c97566228cefbafd14fafa5e79f Mon Sep 17 00:00:00 2001 From: Raymen Scholten Date: Mon, 15 Sep 2025 14:04:27 +0200 Subject: [PATCH 4/6] Remove NuGet.org publishing step from workflow The step "Publish to NuGet.org (if token is available)" has been removed from the workflow. This step previously checked for the presence of a NuGet API key and published `.nupkg` files to NuGet.org using the `dotnet nuget push` command. The workflow now exclusively publishes packages to GitHub Packages. --- .github/workflows/publish-packages.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/publish-packages.yml b/.github/workflows/publish-packages.yml index 1539d4a9..9d641c1e 100644 --- a/.github/workflows/publish-packages.yml +++ b/.github/workflows/publish-packages.yml @@ -81,15 +81,4 @@ jobs: --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ --api-key ${{ secrets.GITHUB_TOKEN }} \ --skip-duplicate - done - - - name: Publish to NuGet.org (if token is available) - if: ${{ vars.NUGET_API_KEY != '' || secrets.NUGET_API_KEY != '' }} - run: | - for package in ./packages/*.nupkg; do - echo "Publishing $package to NuGet.org" - dotnet nuget push "$package" \ - --source https://api.nuget.org/v3/index.json \ - --api-key ${{ secrets.NUGET_API_KEY }} \ - --skip-duplicate done \ No newline at end of file From a5e1a93dafaff95246342f4f6dd91556e19f6df9 Mon Sep 17 00:00:00 2001 From: Raymen Scholten Date: Mon, 15 Sep 2025 14:13:03 +0200 Subject: [PATCH 5/6] Update TargetFrameworks to net8.0 and net9.0 only Dropped support for net6.0 and net7.0 across multiple project files: - Xrpl.AddressCodec.Test.csproj - Xrpl.BinaryCodec.Test.csproj - Xrpl.Keypairs.Test.csproj - Xrpl.Tests.csproj - Xrpl.csproj This change focuses on newer .NET versions for improved compatibility, performance, and feature utilization while reducing maintenance for older frameworks. No other project properties were modified. --- Tests/Xrpl.AddressCodec.Test/Xrpl.AddressCodec.Test.csproj | 2 +- Tests/Xrpl.BinaryCodec.Test/Xrpl.BinaryCodec.Test.csproj | 2 +- Tests/Xrpl.Keypairs.Test/Xrpl.Keypairs.Test.csproj | 2 +- Tests/Xrpl.Tests/Xrpl.Tests.csproj | 2 +- Xrpl/Xrpl.csproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Tests/Xrpl.AddressCodec.Test/Xrpl.AddressCodec.Test.csproj b/Tests/Xrpl.AddressCodec.Test/Xrpl.AddressCodec.Test.csproj index 7bd885bb..1a9b37df 100644 --- a/Tests/Xrpl.AddressCodec.Test/Xrpl.AddressCodec.Test.csproj +++ b/Tests/Xrpl.AddressCodec.Test/Xrpl.AddressCodec.Test.csproj @@ -2,7 +2,7 @@ - net6.0;net7.0;net8.0;net9.0 + net8.0;net9.0 XrplTests diff --git a/Tests/Xrpl.BinaryCodec.Test/Xrpl.BinaryCodec.Test.csproj b/Tests/Xrpl.BinaryCodec.Test/Xrpl.BinaryCodec.Test.csproj index d7e47d14..47ce0001 100644 --- a/Tests/Xrpl.BinaryCodec.Test/Xrpl.BinaryCodec.Test.csproj +++ b/Tests/Xrpl.BinaryCodec.Test/Xrpl.BinaryCodec.Test.csproj @@ -2,7 +2,7 @@ - net6.0;net7.0;net8.0;net9.0 + net8.0;net9.0 XrplTests diff --git a/Tests/Xrpl.Keypairs.Test/Xrpl.Keypairs.Test.csproj b/Tests/Xrpl.Keypairs.Test/Xrpl.Keypairs.Test.csproj index 40763430..c9aada42 100644 --- a/Tests/Xrpl.Keypairs.Test/Xrpl.Keypairs.Test.csproj +++ b/Tests/Xrpl.Keypairs.Test/Xrpl.Keypairs.Test.csproj @@ -2,7 +2,7 @@ - net6.0;net7.0;net8.0;net9.0 + net8.0;net9.0 XrplTests diff --git a/Tests/Xrpl.Tests/Xrpl.Tests.csproj b/Tests/Xrpl.Tests/Xrpl.Tests.csproj index 07a47fc9..01ed08ee 100644 --- a/Tests/Xrpl.Tests/Xrpl.Tests.csproj +++ b/Tests/Xrpl.Tests/Xrpl.Tests.csproj @@ -2,7 +2,7 @@ - net6.0;net7.0;net8.0;net9.0 + net8.0;net9.0 XrplTests diff --git a/Xrpl/Xrpl.csproj b/Xrpl/Xrpl.csproj index 4f891514..9ea643d0 100644 --- a/Xrpl/Xrpl.csproj +++ b/Xrpl/Xrpl.csproj @@ -3,7 +3,7 @@ latest - net6.0;net7.0;net8.0;net9.0 + net8.0;net9.0 Xrpl true Chris Will, Denis Angell, Aleksandr Platonenkov From 4bebf4d1d00d75e777705b842d216b5217e337be Mon Sep 17 00:00:00 2001 From: Raymen Scholten Date: Mon, 15 Sep 2025 14:14:03 +0200 Subject: [PATCH 6/6] Allow releases to proceed despite test failures Updated README.md to document that test failures will not block the release process and provided instructions to change this behavior. Removed references to .NET 6 and 7 in the setup instructions, leaving only .NET 8 and 9. Modified the GitHub Actions workflow to add `continue-on-error: true` to the "Run tests" step, ensuring the workflow proceeds even if tests fail. Added messaging to clarify this behavior and included a fallback message for failed tests. Enhanced documentation to emphasize addressing test failures for production releases and clarified monitoring details. Simplified setup by removing detailed NuGet.org instructions. --- .github/workflows/README.md | 40 +++++++++++--------------- .github/workflows/publish-packages.yml | 9 +++--- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 464d2de8..7dcaf56a 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -1,4 +1,4 @@ -# GitHub Package Publishing Workflow +# GitHub Package Publishing Workflow This repository includes a GitHub Actions workflow that automatically publishes NuGet packages to GitHub Packages (and optionally to NuGet.org) when a new release is created. @@ -10,10 +10,10 @@ The workflow is triggered when: ## What it does 1. **Extracts version from release tag** - The version is automatically extracted from the Git tag -2. **Sets up .NET environment** - Installs .NET 6, 7, 8, and 9 +2. **Sets up .NET environment** - Installs .NET 8, and 9 3. **Restores dependencies** - Downloads all required NuGet packages 4. **Builds the solution** - Compiles all projects in Release configuration -5. **Runs tests** - Executes all unit tests to ensure quality +5. **Runs tests** - Executes all unit tests (⚠️ **Test failures will NOT block the release**) 6. **Updates package versions** - Sets the package version to match the release tag 7. **Creates NuGet packages** - Packs the following projects: - Xrpl.AddressCodec @@ -22,30 +22,31 @@ The workflow is triggered when: - Xrpl (main package) 8. **Publishes packages** - Uploads packages to GitHub Packages and optionally to NuGet.org +## ⚠️ Important Note About Tests + +**The workflow is configured to ignore test failures and continue with the release process.** This means: + +- Tests will still run and their results will be visible in the workflow logs +- If tests fail, the workflow will continue and publish packages anyway +- This is useful for development scenarios where you have known failing tests that shouldn't block releases +- **For production releases, consider fixing failing tests before creating a release** + +To change this behavior and make test failures block releases, remove the `continue-on-error: true` line from the "Run tests" step in the workflow file. + ## Setup Instructions ### 1. GitHub Packages (Automatic) No additional setup required. The workflow uses the built-in `GITHUB_TOKEN` which has the necessary permissions. -### 2. NuGet.org (Optional) -To also publish to NuGet.org: - -1. Go to your repository's **Settings** ? **Secrets and variables** ? **Actions** -2. Click **New repository secret** -3. Name: `NUGET_API_KEY` -4. Value: Your NuGet.org API key - - Get your API key from [nuget.org/account/apikeys](https://www.nuget.org/account/apikeys) - - Create a new key with "Push new packages and package versions" scope - ## Creating a Release 1. Go to your repository on GitHub -2. Click **Releases** ? **Create a new release** +2. Click **Releases** → **Create a new release** 3. Create a new tag (e.g., `v1.0.0`, `2.1.0`, etc.) 4. Fill in the release title and description 5. Click **Publish release** -The workflow will automatically trigger and publish your packages! +The workflow will automatically trigger and publish your packages, even if some tests fail! ## Package Locations @@ -53,13 +54,6 @@ The workflow will automatically trigger and publish your packages! Packages will be available at: - `https://nuget.pkg.github.com/YOUR_USERNAME/index.json` -### NuGet.org (if configured) -Packages will be available at: -- `https://www.nuget.org/packages/Xrpl.AddressCodec/` -- `https://www.nuget.org/packages/Xrpl.BinaryCodec/` -- `https://www.nuget.org/packages/Xrpl.Keypairs/` -- `https://www.nuget.org/packages/Xrpl/` - ## Using GitHub Packages To use packages from GitHub Packages, add this to your `nuget.config`: @@ -85,4 +79,4 @@ The workflow is located at: `.github/workflows/publish-packages.yml` ## Monitoring -You can monitor the workflow execution in the **Actions** tab of your repository. Each release will create a new workflow run that you can view for logs and status. \ No newline at end of file +You can monitor the workflow execution in the **Actions** tab of your repository. Each release will create a new workflow run that you can view for logs and status. Note that even if tests fail, the workflow will show as successful if the packages are published correctly. \ No newline at end of file diff --git a/.github/workflows/publish-packages.yml b/.github/workflows/publish-packages.yml index 9d641c1e..b3d979e9 100644 --- a/.github/workflows/publish-packages.yml +++ b/.github/workflows/publish-packages.yml @@ -24,8 +24,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 6.0.x - 7.0.x 8.0.x 9.0.x @@ -45,7 +43,10 @@ jobs: run: dotnet build --configuration Release --no-restore - name: Run tests - run: dotnet test --configuration Release --no-build --verbosity normal + continue-on-error: true + run: | + echo "Running tests - failures will not block the release" + dotnet test --configuration Release --no-build --verbosity normal || echo "Some tests failed, but continuing with release..." - name: Update package versions run: | @@ -81,4 +82,4 @@ jobs: --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ --api-key ${{ secrets.GITHUB_TOKEN }} \ --skip-duplicate - done \ No newline at end of file + done