forked from KOBENDigital/Iconic
-
Notifications
You must be signed in to change notification settings - Fork 8
63 lines (51 loc) · 2.22 KB
/
release.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
name: Our.Umbraco.Iconic - Release
on:
push:
branches: [ master, v14 ]
env:
SOLUTION: Iconic.sln
PLUGIN_PROJECT: Our.Iconic/Our.Iconic.csproj
CORE_PROJECT: Our.Iconic.Core/Our.Iconic.Core.csproj
OUTPUT_PATH: ${{ github.workspace }}/build.out
jobs:
publish-nuget:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Get Release Version
id: package_version
uses: KageKirin/get-csproj-version@v0
with:
file: ${{ env.PLUGIN_PROJECT }}
regex: ^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
- name: Check Version v${{ steps.package_version.outputs.version }} Pre-Release state
id: check_prerelease
run: |
if [ ${{ steps.package_version.outputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+-.+$ ]; then
echo Pre-Release detected
echo ::set-output name=prerelease::true
else
echo Pre-Release NOT detected
echo ::set-output name=prerelease::false
fi
- name: Restore dependencies
run: dotnet restore
- run: dotnet build --configuration Release
- name: Create Nuget Packages
run: dotnet pack --configuration Release -o ${{ env.OUTPUT_PATH }}
- name: Publish to NuGet
working-directory: ${{ env.OUTPUT_PATH }}
run: dotnet nuget push *.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
- uses: avakar/tag-and-release@v1
name: Create Release Tag v${{ steps.package_version.outputs.version }}
id: release
with:
tag_name: v${{ steps.package_version.outputs.version }}
prerelease: ${{ steps.check_prerelease.outputs.prerelease }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release information for v${{ steps.package_version.outputs.version }}
run: |
echo Release Id: ${{ steps.release.outputs.id }}
echo Upload URL: ${{ steps.release.outputs.upload_url }}
echo Release URL: ${{ steps.release.outputs.html_url }}