Support .Net 6.0 #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pull-requests: write | |
packages: write | |
name: release-please | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dotnet-version: ["3.1.x", "6.0.x"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup dotnet ${{ matrix.dotnet-version }} | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet-version }} | |
- 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: Install dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build -c Release Postal.sln | |
- name: Test | |
run: dotnet test -c Release | |
- name: Upload dotnet test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dotnet-results-${{ matrix.dotnet-version }} | |
path: TestResults-${{ matrix.dotnet-version }} | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
release-please: | |
runs-on: ubuntu-latest | |
needs: test | |
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 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [test, release-please] | |
if: ${{ needs.release-please.outputs.release_created }} | |
steps: | |
- uses: actions/checkout@v3 | |
- 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: 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: Publish the package to myget | |
run: dotnet nuget push src/Postal.AspNetCore/bin/Release/*.nupkg --source https://www.myget.org/F/herman-github/api/v2/package --api-key ${{ secrets.MYGET_API_KEY }} --skip-duplicate | |
- name: Publish the package to Github | |
run: dotnet nuget push src/Postal.AspNetCore/bin/Release/*.nupkg --source https://nuget.pkg.github.com/hermanho/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate |