Skip to content

Commit

Permalink
[net]build(gh): test solution with new NuGet packages before publishi…
Browse files Browse the repository at this point in the history
…ng them (#696)
  • Loading branch information
DennisInSky authored Nov 29, 2024
1 parent 433f764 commit 5d35ea6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
31 changes: 17 additions & 14 deletions .github/workflows/net-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: '[net] Release'
on:
push:
tags:
- 'net/v*-pin'
- 'net/v*'

env:
# see https://api.github.com/users/github-actions%5Bbot%5D
Expand All @@ -21,22 +21,20 @@ jobs:
shell: bash
outputs:
r_version: ${{ steps.release_info.outputs.version }}
r_tag: net/v${{ steps.release_info.outputs.version }}
pin_tag: ${{ steps.release_info.outputs.pin_tag }}
r_tag: ${{ steps.release_info.outputs.r_tag }}

steps:
- name: Extract Release Info
id: release_info
run: |
PIN_TAG=${GITHUB_REF#refs/tags/}
VERSION=${PIN_TAG#net/v}
VERSION="${VERSION%-pin}"
R_TAG=${GITHUB_REF#refs/tags/}
VERSION=${R_TAG#net/v}
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?$ ]]; then
echo "'$VERSION' is not a valid semver version"
exit 1
fi
echo "Pin Tag: $PIN_TAG"
echo "pin_tag=$PIN_TAG" >> $GITHUB_OUTPUT
echo "Release Tag: $R_TAG"
echo "r_tag=$R_TAG" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -151,12 +149,10 @@ jobs:
pattern: native_client_gen_*
merge-multiple: true

- name: Build Solution
run: |
dotnet build --configuration Release -p:LibraryRoot=${{ github.workspace }}/native_client_gens
- name: Test Solution
- name: Build & Test Solution
run: |
dotnet build --configuration Release \
-p:LibraryRoot=${{ github.workspace }}/native_client_gens
dotnet test --no-build --configuration Release --logger "trx;LogFileName=TestResults.trx"
- name: Pack NuGet Packages
Expand All @@ -172,6 +168,14 @@ jobs:
-p:RepositoryUrl=${{ github.server_url }}/${{ github.repository }} \
-p:Authors=Gear
- name: Build & Test Solution with New NuGet Packages
run: |
dotnet nuget add source ./nugets --name local
dotnet build --configuration Release \
-p:LibraryRoot=${{ github.workspace }}/native_client_gens
-p:SailsPackagesVersion=${{ needs.prepare.outputs.r_version }}
dotnet test --no-build --configuration Release --logger "trx;LogFileName=TestResults.trx"
- name: Publish NuGet Packages to NuGet.org
run: |
dotnet nuget push ./nugets/*.nupkg \
Expand Down Expand Up @@ -203,7 +207,6 @@ jobs:
git config user.email "$GITHUB_USER_EMAIL"
git tag -a "$R_TAG" -m "Release .Net v${{ needs.prepare.outputs.r_version }}"
git push origin "$R_TAG"
git push origin --delete "${{ needs.prepare.outputs.pin_tag }}"
- name: Create Draft Release
uses: softprops/action-gh-release@v2
Expand Down
4 changes: 4 additions & 0 deletions net/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<LangVersion>12.0</LangVersion>
</PropertyGroup>

<PropertyGroup>
<SailsPackagesVersion>0.0.1-beta.3</SailsPackagesVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Roslynator.Analyzers">
<PrivateAssets>all</PrivateAssets>
Expand Down
4 changes: 2 additions & 2 deletions net/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
<!-- Examples -->
<PackageVersion Include="Sails.ClientGenerator" Version="0.0.1-beta.3" />
<PackageVersion Include="Sails.Net" Version="0.0.1-beta.3" />
<PackageVersion Include="Sails.ClientGenerator" Version="$(SailsPackagesVersion)" />
<PackageVersion Include="Sails.Net" Version="$(SailsPackagesVersion)" />
</ItemGroup>
</Project>

0 comments on commit 5d35ea6

Please sign in to comment.