forked from andrewdavey/postal
-
Notifications
You must be signed in to change notification settings - Fork 9
94 lines (88 loc) · 3.09 KB
/
release-please.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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