Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Sep 20, 2023
1 parent ae8d531 commit e1eb417
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 136 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/relase.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release to NuGet

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

- name: Setup dotnet
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # v3.0.3

- name: Build
run: dotnet build --configuration Release

- name: Test
run: >
dotnet test
--no-build
--framework net462
--configuration Release
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
--
RunConfiguration.CollectSourceInformation=true
- name: Pack nugets
run: >
dotnet pack
--configuration Release
--no-build
--output .
- name: Push to NuGet
run: >
dotnet nuget push *.nupkg
--source https://api.nuget.org/v3/index.json
--api-key ${{secrets.nuget_api_key}}
74 changes: 47 additions & 27 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ jobs:
clean_name: ${{steps.clean_branch_name.outputs.CLEAN_BRANCH_NAME}}

steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

- name: Setup dotnet
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a #v3.0.3
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # v3.0.3
# with:
# dotnet-version: ${{ matrix.dotnet-version }}

# You can test your matrix by printing the current dotnet version
- name: Display dotnet version
run: dotnet --version
Expand All @@ -35,36 +38,43 @@ jobs:
run: dotnet restore --locked-mode

- name: Build
run: dotnet build -f net6.0 --verbosity minimal --no-restore
run: >
dotnet build
--no-restore
--framework net6.0
--configuration Release
--verbosity minimal
- name: Check Format
run: dotnet format --verify-no-changes --no-restore

- name: Test with the dotnet CLI
run: dotnet test --no-build --no-restore --framework net6.0 --logger "trx;LogFileName=pw-test-results.trx"
run: >
dotnet test
--no-build
--no-restore
--framework net6.0
--configuration Release
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
--
RunConfiguration.CollectSourceInformation=true
- id: clean_branch_name
name: Clean Branch Name
run: echo "CLEAN_BRANCH_NAME=${BRANCH_NAME/\//-}" >> "$GITHUB_OUTPUT"
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

- name: Report test results
uses: dorny/test-reporter@c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226 # v1.6.0
if: always()
with:
name: Test Results
path: "**/*-test-results.trx"
reporter: dotnet-trx
fail-on-error: true

build-framework:
runs-on: windows-latest
needs: build-dotnet
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

# - name: Setup dotnet
# uses: setup msbuild?

- name: Display dotnet version
run: |
dotnet --version
Expand All @@ -75,29 +85,39 @@ jobs:

- name: Build
# Don't specify a framework here so we build both .NET and .NET Framework so we can pack both
run: dotnet build --verbosity minimal --no-restore
run: >
dotnet build
--no-restore
--configuration Release
--verbosity minimal
# Don't bother running formatting for this build

- name: Test with the dotnet CLI
# We will have already ran the tests on ubuntu, so only do .NET Framework ones here
run: dotnet test --no-build --no-restore --framework net462 --logger "trx;LogFileName=pw-framework-test-results.trx"

- name: Report test results
uses: dorny/test-reporter@c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226 # v1.6.0
if: always()
with:
name: Test Results
path: "**/*-test-results.trx"
reporter: dotnet-trx
fail-on-error: true
run: >
dotnet test
--no-build
--no-restore
--framework net462
--configuration Release
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
--
RunConfiguration.CollectSourceInformation=true
- name: Pack NuGet Packages
run: dotnet pack --no-build --version-suffix "ci-${{ env.CLEAN_BRANCH_NAME }}-${{ github.run_id }}"
run: >
dotnet pack
--no-build
--configuration Release
--version-suffix "ci-${{ env.CLEAN_BRANCH_NAME }}-${{ github.run_id }}"
env:
CLEAN_BRANCH_NAME: ${{needs.build-dotnet.outputs.clean_name}}

- name: Publish NuGet Packages
run: dotnet nuget push **/*.nupkg --source https://nuget.pkg.github.com/passwordless/index.json --api-key ${{env.GITHUB_TOKEN}}
run: >
dotnet nuget push **/*.nupkg
--source https://nuget.pkg.github.com/passwordless/index.json
--api-key ${{env.GITHUB_TOKEN}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<PropertyGroup>
<CurrentPreviewTfm>net8.0</CurrentPreviewTfm>
<!--<IncludePreview>true</IncludePreview>-->
<IncludePreview Condition=" '$(IncludePreview)' == ''">false</IncludePreview>
<IncludePreview Condition="'$(IncludePreview)' == ''">false</IncludePreview>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -19,7 +20,7 @@

<ItemGroup>
<!--
The .NET Framework target doesn't seem to like this implicit using so we
The .NET Framework target doesn't seem to like this implicit using so we
have to bring it in for each file, so might as well remove it for .NET targets too.
-->
<Using Remove="System.Net.Http" />
Expand Down
Loading

0 comments on commit e1eb417

Please sign in to comment.