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

[net]build(gh): test solution with new NuGet packages before publishing them #696

Merged
merged 1 commit into from
Nov 29, 2024
Merged
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
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>