Skip to content

Commit dab693c

Browse files
committed
ci: add release workflow
1 parent 751a508 commit dab693c

File tree

2 files changed

+76
-5
lines changed

2 files changed

+76
-5
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ name: build
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- 'renovate/**'
8-
pull_request:
9-
branches: [main]
5+
6+
env:
7+
DOTNET_NOLOGO: true # https://github.com/actions/setup-dotnet#environment-variables-to-use-with-dotnet
108

119
concurrency:
1210
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
@@ -21,6 +19,7 @@ jobs:
2119

2220
steps:
2321
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
22+
2423
- name: Setup .NET
2524
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # v3.0.3
2625
with:
@@ -35,7 +34,9 @@ jobs:
3534

3635
- name: Restore dependencies
3736
run: dotnet restore
37+
3838
- name: Build
3939
run: dotnet build --no-restore
40+
4041
- name: Test
4142
run: dotnet test --no-build --verbosity normal

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
env:
9+
CONFIGURATION: Release
10+
DOTNET_NOLOGO: true
11+
12+
permissions:
13+
contents: read
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
release:
21+
runs-on: windows-latest
22+
timeout-minutes: 15
23+
permissions:
24+
packages: write
25+
contents: write
26+
27+
steps:
28+
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
29+
30+
- uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d # v3.2.2
31+
with:
32+
path: ~/.nuget/packages
33+
# Look to see if there is a cache hit for the corresponding requirements file
34+
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
35+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
36+
# restore-keys: |
37+
# ${{ runner.os }}-nuget
38+
39+
- name: restore
40+
run: dotnet restore
41+
42+
- name: build
43+
run: dotnet build --no-restore
44+
45+
- name: pack
46+
run: dotnet pack --no-build -o bin
47+
48+
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
49+
with:
50+
name: packages
51+
path: bin/*.nupkg
52+
53+
- name: deploy github.com
54+
run: find bin -name '*.nupkg' | xargs dotnet nuget push -s $NUGET_SOURCE -k $NUGET_KEY --skip-duplicate --force-english-output
55+
shell: bash
56+
env:
57+
NUGET_SOURCE: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
58+
NUGET_KEY: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: deploy nuget.org
61+
run: find bin -name '*.nupkg' | xargs dotnet nuget push -s $NUGET_SOURCE -k $NUGET_KEY --skip-duplicate --force-english-output
62+
shell: bash
63+
env:
64+
NUGET_SOURCE: https://api.nuget.org/v3/index.json
65+
NUGET_KEY: ${{ secrets.NUGET_API_KEY }}
66+
67+
- uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0 # v1.2.1
68+
with:
69+
repo_token: ${{ secrets.GITHUB_TOKEN }}
70+
prerelease: ${{ contains(github.ref_name, '-') }}

0 commit comments

Comments
 (0)