diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 00000000..7dcaf56a --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,82 @@ +# 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 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 (⚠️ **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 + - Xrpl.BinaryCodec + - Xrpl.Keypairs + - 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. + +## 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, even if some tests fail! + +## Package Locations + +### GitHub Packages +Packages will be available at: +- `https://nuget.pkg.github.com/YOUR_USERNAME/index.json` + +## 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. 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 new file mode 100644 index 00000000..b3d979e9 --- /dev/null +++ b/.github/workflows/publish-packages.yml @@ -0,0 +1,85 @@ +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: | + 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 + 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: | + 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 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.
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