Skip to content

Commit

Permalink
Add a release workflow and docs
Browse files Browse the repository at this point in the history
Signed-off-by: James Sturtevant <[email protected]>
  • Loading branch information
jsturtevant committed Jun 14, 2024
1 parent 703570d commit 78bd9d8
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 14 deletions.
33 changes: 27 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ on:
pull_request:
branches: [ "main" ]
workflow_dispatch:
# used for [release](https://github.com/bytecodealliance/componentize-dotnet/blob/main/RELEASE.md)
branches: [ "main" ]
inputs:
test-run:
description: 'Run the workflow publishing to https://int.nugettest.org'
default: 'false'
description: 'Run the workflow with out publishing step'
default: 'true'
required: false


Expand Down Expand Up @@ -51,6 +52,8 @@ jobs:
release:
runs-on: windows-latest
needs: build
permissions:
contents: write
name: Release
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
steps:
Expand All @@ -63,9 +66,27 @@ jobs:
uses: actions/download-artifact@v4
with:
name: nuget-packages
- name: Extract nuget version
id: extract_version
run: |
version=$(unzip -p artifacts/SDK*.nupkg '*.nuspec' | grep -oPm1 "(?<=<version>)[^<]+")
echo "Version: $version"
echo "version=$version" >> $GITHUB_OUTPUT
# Publish to https://nuget.org and tag the version on repo if not test-run
- name: Publish
run: dotnet nuget push artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push ./*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
if: ${{ !inputs.test-run }}
- name: Publish Test Run
run: dotnet nuget push artifacts/*.nupkg --source https://int.nugettest.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
if: ${{ inputs.test-run }}
- name: Push version tag
if: ${{ !inputs.test-run }}
env:
TAG: v${{ steps.extract_version.outputs.version }}"
run: |
git tag $TAG
git push origin $TAG
- name: Create release
if: ${{ !inputs.dry_run }}
run: |
gh release create $TAG --generate-notes --prerelease
env:
GH_TOKEN: ${{ github.token }}
TAG: v${{ steps.extract_version.outputs.version }}"
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ With this package, you can add one NuGet reference. The build output is fully AO

If you don't already have it, install [.NET 8+ SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)

### 2. Create a project and add WasmComponent.Sdk package
### 2. Create a project and add ByteCodeAlliance.Componentize.DotNet.Wasm.SDK package

* `dotnet new console -o MyApp`
* `cd MyApp`
* `dotnet new nugetconfig`
* `dotnet nuget add source --name dotnet8-experimental https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json`
* `dotnet add package WasmComponent.Sdk --prerelease`
* `dotnet add package ByteCodeAlliance.Componentize.DotNet.Wasm.SDK --prerelease`

### 3. Configure the compilation output

Expand Down
20 changes: 20 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Releasing the package

1. Open a PR to update the `<VersionPrefix>` tag in [Directory.Build.Props](./Directory.Build.props)
2. Maintainers approve and merge PR
3. After the PR merges a maintainer triggers the Release workflow on the main branch via the github Actions UI or runs:

```
gh workflow run build -f test-run=false
```

4. The release flow will build and publish the packages to nuget, tag the repository with version of the release, and create a GH release
5. Maintainer updates release notes with package info:

```
# https://www.nuget.org/packages/ByteCodeAlliance.Componentize.DotNet.Wasm.SDK
dotnet add package ByteCodeAlliance.Componentize.DotNet.Wasm.SDK
# https://www.nuget.org/packages/ByteCodeAlliance.Componentize.DotNet.WitBindgen
dotnet add package ByteCodeAlliance.Componentize.DotNet.WitBindgen
```
13 changes: 13 additions & 0 deletions src/WasmComponent.Sdk/WasmComponent.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
<Import Project="build\WasmComponent.Sdk.props" />

<PropertyGroup>
<PackageId>ByteCodeAlliance.Componentize.DotNet.Wasm.SDK</PackageId>
<Authors>ByteCode Alliance Developers</Authors>
<Description>Tooling for creating WebAssembly components from C#</Description>
<RepositoryUrl>https://github.com/bytecodealliance/componentize-dotnet</RepositoryUrl>
<PackageLicenseExpression>Apache-2.0 WITH LLVM-exception</PackageLicenseExpression>
<PackageReadmeFile>Readme.md</PackageReadmeFile>
<PackageTags>webassembly, .net, wasm</PackageTags>
<PackageReleaseNotes>https://github.com/bytecodealliance/componentize-dotnet/releases/tag/$(PackageVersion)</PackageReleaseNotes>

<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand All @@ -27,6 +36,10 @@
<ProjectReference Include="..\WitBindgen\WitBindgen.csproj" PrivateAssets="None" />
</ItemGroup>

<ItemGroup>
<None Include="../../Readme.md" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup>
<None Include="ImportInDev.proj" />
</ItemGroup>
Expand Down
13 changes: 13 additions & 0 deletions src/WitBindgen/WitBindgen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
<Import Project="build\WitBindgen.props" />

<PropertyGroup>
<PackageId>ByteCodeAlliance.Componentize.DotNet.WitBindgen</PackageId>
<Authors>ByteCode Alliance Developers</Authors>
<Description>Tooling for creating WebAssembly components from C#</Description>
<RepositoryUrl>https://github.com/bytecodealliance/componentize-dotnet</RepositoryUrl>
<PackageLicenseExpression>Apache-2.0 WITH LLVM-exception</PackageLicenseExpression>
<PackageReadmeFile>Readme.md</PackageReadmeFile>
<PackageTags>webassembly, .net, wasm</PackageTags>
<PackageReleaseNotes>https://github.com/bytecodealliance/componentize-dotnet/releases/tag/$(PackageVersion)</PackageReleaseNotes>

<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand All @@ -22,6 +31,10 @@
<IncludeBuildOutput>false</IncludeBuildOutput>
</PropertyGroup>

<ItemGroup>
<None Include="../../Readme.md" Pack="true" PackagePath="\"/>
</ItemGroup>

<Target Name="BuildOrDownloadNativeTooling" BeforeTargets="BeforeBuild" DependsOnTargets="BuildNativeTooling; DownloadNativeTooling">
</Target>

Expand Down
2 changes: 1 addition & 1 deletion test/E2ETest/testapps/E2EConsumer/E2EConsumer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="WasmComponent.Sdk" Version="$(PackageVersion)" />
<PackageReference Include="ByteCodeAlliance.Componentize.DotNet.Wasm.SDK" Version="$(PackageVersion)" />

<!-- Just to ensure build order -->
<ProjectReference Include="..\E2EProducer\E2EProducer.csproj" ReferenceOutputAssembly="false" />
Expand Down
2 changes: 1 addition & 1 deletion test/E2ETest/testapps/E2EProducer/E2EProducer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="WasmComponent.Sdk" Version="$(PackageVersion)" />
<PackageReference Include="ByteCodeAlliance.Componentize.DotNet.Wasm.SDK" Version="$(PackageVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions test/E2ETest/testapps/nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</packageSources>
<packageSourceMapping>
<packageSource key="dev">
<package pattern="WitBindgen" />
<package pattern="WasmComponent.Sdk" />
<package pattern="ByteCodeAlliance.Componentize.DotNet.WitBindgen" />
<package pattern="ByteCodeAlliance.Componentize.DotNet.Wasm.SDK" />
</packageSource>
</packageSourceMapping>
</configuration>

0 comments on commit 78bd9d8

Please sign in to comment.