Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -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
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="github" value="https://nuget.pkg.github.com/YOUR_USERNAME/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="YOUR_USERNAME" />
<add key="ClearTextPassword" value="YOUR_PERSONAL_ACCESS_TOKEN" />
</github>
</packageSourceCredentials>
</configuration>
```

## 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.
85 changes: 85 additions & 0 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
@@ -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>.*<\/PackageVersion>/<PackageVersion>$VERSION<\/PackageVersion>/g" Base/Xrpl.AddressCodec/Xrpl.AddressCodec.csproj
sed -i "s/<PackageVersion>.*<\/PackageVersion>/<PackageVersion>$VERSION<\/PackageVersion>/g" Base/Xrpl.BinaryCodec/Xrpl.BinaryCodec.csproj
sed -i "s/<PackageVersion>.*<\/PackageVersion>/<PackageVersion>$VERSION<\/PackageVersion>/g" Base/Xrpl.Keypairs/Xrpl.Keypairs.csproj
sed -i "s/<PackageVersion>.*<\/PackageVersion>/<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
7 changes: 7 additions & 0 deletions Base/Xrpl.BinaryCodec/Enums/TransactionType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ private static TransactionType Add(string name, int ordinal)
public static readonly TransactionType NFTokenCancelOffer = Add(nameof(NFTokenCancelOffer), 28);
/// <summary> This transaction accepts an existing offer to buy or sell an existing NFT. </summary>
public static readonly TransactionType NFTokenAcceptOffer = Add(nameof(NFTokenAcceptOffer), 29);

/// <summary>
/// This transaction allows an issuer to reclaim funds from an account.
/// </summary>
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);
Expand All @@ -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);


// ...
/// <summary>
/// This system-generated transaction type is used to update the status of the various amendments. <br/>
Expand Down
2 changes: 1 addition & 1 deletion Tests/Xrpl.AddressCodec.Test/Xrpl.AddressCodec.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<!-- <TargetFramework>netstandard2.0</TargetFramework> -->
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<RootNamespace>XrplTests</RootNamespace>
</PropertyGroup>
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Tests/Xrpl.BinaryCodec.Test/Xrpl.BinaryCodec.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<!-- <TargetFramework>netstandard2.0</TargetFramework> -->
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<RootNamespace>XrplTests</RootNamespace>
</PropertyGroup>
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Tests/Xrpl.Keypairs.Test/Xrpl.Keypairs.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<!-- <TargetFramework>netstandard2.0</TargetFramework> -->
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<RootNamespace>XrplTests</RootNamespace>
</PropertyGroup>
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Tests/Xrpl.Tests/Xrpl.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<!-- <TargetFramework>netstandard2.0</TargetFramework> -->
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<RootNamespace>XrplTests</RootNamespace>
</PropertyGroup>
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Xrpl/Xrpl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<!-- <TargetFramework>netstandard2.0</TargetFramework> -->
<LangVersion>latest</LangVersion>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<RootNamespace>Xrpl</RootNamespace>
<PackOnBuild>true</PackOnBuild>
<Authors>Chris Will, Denis Angell, Aleksandr Platonenkov</Authors>
Expand Down
Loading