-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (66 loc) · 2.49 KB
/
publish.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
name: Publish
on:
push:
tags:
- v*
jobs:
build:
runs-on: windows-latest
steps:
- name: Extract version from tag
uses: nowsprinting/check-version-format-action@v3
id: version
with:
prefix: 'v'
- name: Invalid version tag
if: steps.version.outputs.is_valid != 'true'
run: |
echo "Version tag format invalid: ${{ steps.version.outputs.full }}"
exit 1
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Mandatory to use exact version from tag action
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Check version
# assert version match with project version so only pre-release label can be changed based on release tag
run: dotnet build -t:CheckVersion -c Release -p BuildVersion="${{ steps.version.outputs.major_without_prefix }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}"
- name: Set version info
run: |
$VersionPrefix="${{ steps.version.outputs.major_without_prefix }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}"
$VersionSuffix="${{ steps.version.outputs.prerelease }}"
$IsStable="${{ steps.version.outputs.is_stable }}"
if ( -not $VersionSuffix ) {
$Version=$VersionPrefix
} else {
$Version="$VersionPrefix-$VersionSuffix"
}
echo "VersionPrefix=$VersionPrefix" >> $Env:GITHUB_ENV
echo "VersionSuffix=$VersionSuffix" >> $Env:GITHUB_ENV
echo "Version=$Version" >> $Env:GITHUB_ENV
echo "IsStable=$IsStable" >> $Env:GITHUB_ENV
echo "Create release: v$Version"
- name: Build
run: dotnet build aqua.tool.Validation -c Release /bl
- name: Upload build log
uses: actions/upload-artifact@v3
with:
name: msbuild_log
path: msbuild.binlog
if-no-files-found: error
- name: Upload packages
uses: actions/upload-artifact@v3
with:
name: nuget_packages
path: artifacts\*.nupkg
if-no-files-found: error
- name: Publish packages
env:
CI_MYGET_KEY: ${{ secrets.CI_MYGET_KEY }}
CI_NUGET_KEY: ${{ secrets.CI_NUGET_KEY }}
run: |
dotnet nuget push artifacts\*.nupkg -k "$env:CI_MYGET_KEY" -s https://www.myget.org/F/aqua/api/v3/index.json
dotnet nuget push artifacts\*.nupkg -k "$env:CI_NUGET_KEY" -s https://api.nuget.org/v3/index.json