Skip to content

Commit

Permalink
feat: Support .Net 6.0
Browse files Browse the repository at this point in the history
Release-As: 3.0.0
  • Loading branch information
hermanho committed Sep 12, 2023
1 parent 05c4f92 commit fd3ad88
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 21 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
dotnet-version: ["3.1.x", "6.0.x"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup dotnet ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Build
run: dotnet build -c Release Postal.sln
- name: Test
run: dotnet test -c Release
run: dotnet test -c Release --logger "trx;LogFileName=TestResults-${{ matrix.dotnet-version }}.trx"
- name: Upload dotnet test results
uses: actions/upload-artifact@v3
with:
Expand All @@ -39,3 +39,35 @@ jobs:
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}

test-pack:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
6.0.x
- name: Display dotnet version
run: dotnet --version
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Add SHORT_SHA env property with commit short sha
run: |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
echo "GITHUB_RELEASE=true" >> $GITHUB_ENV
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release Postal.sln
- name: Create the package
run: dotnet pack src/Postal.AspNetCore/Postal.AspNetCore.csproj -c Release
- name: List src/Postal.AspNetCore/bin/Release/
run: ls -la src/Postal.AspNetCore/bin/Release/
49 changes: 43 additions & 6 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
dotnet-version: ["3.1.x", "6.0.x"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup dotnet ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Build
run: dotnet build -c Release Postal.sln
- name: Test
run: dotnet test -c Release
run: dotnet test -c Release --logger "trx;LogFileName=TestResults-${{ matrix.dotnet-version }}.trx"
- name: Upload dotnet test results
uses: actions/upload-artifact@v3
with:
Expand All @@ -49,24 +49,57 @@ jobs:
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}

test-pack:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
6.0.x
- name: Display dotnet version
run: dotnet --version
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Add SHORT_SHA env property with commit short sha
run: |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
echo "GITHUB_RELEASE=true" >> $GITHUB_ENV
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release Postal.sln
- name: Create the package
run: dotnet pack src/Postal.AspNetCore/Postal.AspNetCore.csproj -c Release
- name: List src/Postal.AspNetCore/bin/Release/
run: ls -la src/Postal.AspNetCore/bin/Release/

release-please:
runs-on: ubuntu-latest
needs: test
needs: [test, test-pack]
outputs:
release_created: ${{steps.release.outputs.release_created}}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: simple
package-name: Postal.AspNetCore
command: manifest

deploy:
runs-on: ubuntu-latest
needs: [test, release-please]
needs: [test, test-pack, release-please]
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
Expand All @@ -82,6 +115,10 @@ jobs:
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Add SHORT_SHA env property with commit short sha
run: |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
echo "GITHUB_RELEASE=true" >> $GITHUB_ENV
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "3.0.0-pre.3"
}
18 changes: 5 additions & 13 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,26 @@
</PropertyGroup>
<PropertyGroup>
<TODAY>$([System.DateTime]::Now.ToString("yyyyMMdd-hhmmss"))</TODAY>
<BUILD_SOURCEVERSION_SHORT Condition=" '$(BUILD_SOURCEVERSION)' != '' ">$(BUILD_SOURCEVERSION.Substring(0,7))</BUILD_SOURCEVERSION_SHORT>
<InformationalVersion Condition=" '$(BUILD_SOURCEVERSION_SHORT)' != '' ">$(InformationalVersion)git:$(BUILD_SOURCEVERSION_SHORT)</InformationalVersion>
<InformationalVersion Condition=" '$(SHORT_SHA)' != '' ">$(InformationalVersion)git:$(SHORT_SHA)</InformationalVersion>
</PropertyGroup>
<Choose>
<When Condition=" '$(Prerelease)' != '' ">
<PropertyGroup>
<!-- Prerelease version numbers are MAJOR.MINOR.0-pre-build###### -->
<VersionSuffix>$(Prerelease)-build$(BUILD_BUILDID.PadLeft(2, '0'))</VersionSuffix>
<VersionSuffix Condition=" '$(BUILD_SOURCEVERSION_SHORT)' != '' ">$(Prerelease)-$(BUILD_SOURCEVERSION_SHORT)</VersionSuffix>
<VersionSuffix Condition=" '$(SHORT_SHA)' != '' ">$(Prerelease)-$(SHORT_SHA)</VersionSuffix>
</PropertyGroup>
</When>
<When Condition=" '$(Release)' == 'true' ">
<When Condition=" '$(GITHUB_RELEASE)' == 'true' ">
<PropertyGroup>
<!-- Release version numbers are MAJOR.MINOR.# -->
<VersionPrefix>$(VersionPrefix).$(BUILD_BUILDID.PadLeft(2, '0'))</VersionPrefix>
</PropertyGroup>
</When>
<When Condition=" '$(TRAVIS_TAG)' != '' and $(TRAVIS_TAG.StartsWith('v'))">
<PropertyGroup>
<!-- Release version numbers are MAJOR.MINOR.# -->
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<!-- append the build number if it is available -->
<VersionSuffix Condition=" '$(TRAVIS_BUILD_NUMBER)' != '' ">$(VersionSuffix)$(TRAVIS_BUILD_NUMBER)</VersionSuffix>
<VersionSuffix Condition=" '$(BUILD_SOURCEVERSION_SHORT)' != '' ">$(VersionSuffix)-$(BUILD_SOURCEVERSION_SHORT)</VersionSuffix>
<VersionSuffix Condition=" '$(GITHUB_RUN_NUMBER)' != '' ">$(VersionSuffix)$(GITHUB_RUN_NUMBER)</VersionSuffix>
<VersionSuffix Condition=" '$(SHORT_SHA)' != '' ">$(VersionSuffix)-$(SHORT_SHA)</VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' == '' ">build$(TODAY)</VersionSuffix>
</PropertyGroup>
</Otherwise>
Expand Down
17 changes: 17 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"packages": {
".": {
"package-name": "Postal.AspNetCore",
"release-type": "simple",
"prerelease": false,
"extra-files": [
{
"type": "xml",
"path": "Directory.Build.props",
"xpath": "//Project/PropertyGroup[1]/VersionPrefix"
}
]
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}

0 comments on commit fd3ad88

Please sign in to comment.