-
Notifications
You must be signed in to change notification settings - Fork 14
49 lines (41 loc) · 1.62 KB
/
Copy pathrelease.yml
File metadata and controls
49 lines (41 loc) · 1.62 KB
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
name: Release
# Creates a GitHub release when a version tag is pushed. See RELEASING.md.
#
# Publishing to nuget.org stays manual - download the .nupkg from the release
# and upload it at https://www.nuget.org/packages/manage/upload
# That means this workflow needs no secrets: the built-in GITHUB_TOKEN is
# enough to create a release.
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*' # pre-release, eg 1.3.0-beta1
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # to create the release
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
# The csproj is the source of truth for the version. Fail loudly rather
# than publish a package whose number disagrees with the tag.
- name: Check the tag matches <Version> in the csproj
run: |
csproj=src/Mapi/SimpleMapi.SDK.csproj
version=$(sed -n 's:.*<Version>\([^<]*\)</Version>.*:\1:p' "$csproj" | head -1)
if [ "$version" != "$GITHUB_REF_NAME" ]; then
echo "::error::tag $GITHUB_REF_NAME does not match <Version> $version in $csproj"
exit 1
fi
echo "releasing $version"
# Output path comes from <PackageOutputPath> in the csproj: artifacts/
- name: Pack
run: dotnet pack src/Mapi/SimpleMapi.SDK.csproj -c Release -p:ContinuousIntegrationBuild=true
- name: Create the GitHub release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*.nupkg
generate_release_notes: true