Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release pipeline #79

Merged
merged 18 commits into from
Dec 6, 2023
116 changes: 116 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Release

on:
workflow_dispatch:

env:
RUST_VERSION: 1.68

jobs:
build-native-ubuntu:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Rust
run: |
rustup default ${{ env.RUST_VERSION }}

- name: Build Rust Project
run: cargo build --manifest-path=./rust-bindings/Cargo.toml --release

- name: Upload linux library
uses: actions/upload-artifact@master
with:
name: linux-library
path: ./rust-bindings/target/release/librust_bindings.so

build-native-macos:
runs-on: macos-12

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Rust
run: |
rustup default ${{ env.RUST_VERSION }}

- name: Build Rust Project
run: cargo build --manifest-path=./rust-bindings/Cargo.toml --release

- name: Upload macos library
uses: actions/upload-artifact@master
with:
name: macos-library
path: ./rust-bindings/target/release/librust_bindings.dylib

build-native-windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Rust
run: |
rustup default ${{ env.RUST_VERSION }}

- name: Build Rust Project
run: cargo build --manifest-path=./rust-bindings/Cargo.toml --release

- name: Upload windows library
uses: actions/upload-artifact@master
with:
name: windows-library
path: ./rust-bindings/target/release/rust_bindings.dll

build-and-release:
needs: [build-native-ubuntu, build-native-macos, build-native-windows]
runs-on: ubuntu-latest
environment: release

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Download linux library
uses: actions/download-artifact@master
with:
name: linux-library
path: rust-bindings/target/release

- name: Download macos library
uses: actions/download-artifact@master
with:
name: macos-library
path: rust-bindings/target/release

- name: Download windows library
uses: actions/download-artifact@master
with:
name: windows-library
path: rust-bindings/target/release

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Pack
run: dotnet pack -c Release -p:RunRustBuild=false -p:IncludeAllRustBuilds=true

- name: Upload package for validation
uses: actions/upload-artifact@master
with:
name: package-validation
path: ./src/bin/Release

- name: Publish to NuGet
run: dotnet nuget push "src/bin/Release/ConcordiumNetSdk.*.nupkg" --api-key ${{ secrets.NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json
22 changes: 14 additions & 8 deletions src/Concordium.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageVersion>4.1.0</PackageVersion>
<Description>
A .NET integration library written in C# which adds support for
constructing and sending various transactions, as well as querying
Expand All @@ -16,7 +15,7 @@
<PackageTags>concordium;concordium-net-sdk;blockchain;sdk;</PackageTags>
<Company>Concordium</Company>
<PackageId>ConcordiumNetSdk</PackageId>
<Version>4.0.1</Version>
<Version>4.1.0</Version>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseExpression>MPL-2.0</PackageLicenseExpression>
Expand All @@ -25,6 +24,7 @@
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
<RunRustBuild>true</RunRustBuild>
<IncludeAllRustBuilds>false</IncludeAllRustBuilds>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -75,16 +75,22 @@


<ItemGroup>
<!-- Include librust.dll on Windows -->
<None Include="../rust-bindings/target/release/librust_bindings.dll" Condition="'$(IsWindows)'=='true'">
<!-- Include rust_bindings.dll on Windows -->
<None Include="../rust-bindings/target/release/rust_bindings.dll" Condition="'$(IsWindows)'=='true' Or '$(IncludeAllRustBuilds)'=='true'">
<PackageCopyToOutput>true</PackageCopyToOutput>
<Pack>True</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<!-- Include librust.dylib on macOS -->
<None Include="../rust-bindings/target/release/librust_bindings.dylib" Condition="'$(IsOSX)'=='true'">
<!-- Include librust_bindings.dylib on macOS -->
<None Include="../rust-bindings/target/release/librust_bindings.dylib" Condition="'$(IsOSX)'=='true' Or '$(IncludeAllRustBuilds)'=='true'">
<PackageCopyToOutput>true</PackageCopyToOutput>
<Pack>True</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<!-- Include librust.so on Linux -->
<None Include="../rust-bindings/target/release/librust_bindings.so" Condition="'$(IsLinux)'=='true'">
<!-- Include librust_bindings.so on Linux -->
<None Include="../rust-bindings/target/release/librust_bindings.so" Condition="'$(IsLinux)'=='true' Or '$(IncludeAllRustBuilds)'=='true'">
limemloh marked this conversation as resolved.
Show resolved Hide resolved
<PackageCopyToOutput>true</PackageCopyToOutput>
<Pack>True</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Expand Down