Skip to content

Commit

Permalink
Add work-in-progress GitHub workflow to update C# libs
Browse files Browse the repository at this point in the history
  • Loading branch information
skibitsky committed Dec 13, 2023
1 parent 62e1c8b commit 17a0695
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/scripts/move-libs.csx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env dotnet-script

using System;
using System.IO;
using System.Linq;

var sourceDirectory = Args[0];
var targetDirectory = "./Packages/com.walletconnect.core/Runtime/WalletConnectSharp";
var externalDirectory = Path.Combine(targetDirectory, "External");

Directory.CreateDirectory(targetDirectory);
Directory.CreateDirectory(externalDirectory);

var excludedDlls = Environment.GetEnvironmentVariable("EXCLUDED_DLLS")?.Split(',');

foreach (var file in Directory.GetFiles(sourceDirectory, "*.dll"))
{
var fileName = Path.GetFileName(file);

if (fileName.StartsWith("WalletConnectSharp"))
{
Console.WriteLine($"Moving {fileName} to {targetDirectory}");
File.Move(file, Path.Combine(targetDirectory, fileName), true);
}
else if (excludedDlls == null || !excludedDlls.Contains(fileName))
{
Console.WriteLine($"Moving {fileName} to {externalDirectory}");
File.Move(file, Path.Combine(externalDirectory, fileName), true);
}
}
52 changes: 52 additions & 0 deletions .github/workflows/update-csharp-libs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Update C# Libraries

on:
repository_dispatch:
types: [new-release]

jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
cache: true
run: dotnet tool install -g dotnet-script

- name: Download build artifacts
uses: dawidd6/action-download-artifact@v2
with:
workflow: release.yml
workflow_conclusion: success
name: build-artifacts
repo: walletconnectsharp
owner: walletconnect
token: ${{ secrets.PAT }}

- name: Extract DLLs
run: |
mkdir -p ./temp/extracted-dlls
unzip build-artifacts.zip -d ./temp/extracted-dlls
- name: Move DLLs
env:
EXCLUDED_DLLS: "Microsoft.Bcl.AsyncInterfaces.dll,Microsoft.CSharp.dll,Newtonsoft.Json.dll,System.Buffers.dll,System.Memory.dll,System.Numerics.Vectors.dll,System.Runtime.CompilerServices.Unsafe.dll,System.Runtime.InteropServices.WindowsRuntime.dll,System.Security.Cryptography.Cng.dll,System.Text.Encodings.Web.dll,System.Text.Json.dll,System.Threading.Tasks.Extensions.dll"
run: |
chmod +x ./.github/workflows/scripts/move-libs.csx
./.github/workflows/scripts/move-libs.csx ./temp/extracted-dlls/WalletConnectSharp.Sign/bin/Release/netstandard2.1
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: Update WalletConnectSharp
title: Update WalletConnectSharp
body: |
This PR updates WalletConnectSharp to the latest release version
branch: chore/update-walletconnectsharp
delete-branch: true
reviewers: skibitsky

0 comments on commit 17a0695

Please sign in to comment.