@@ -3,7 +3,7 @@ name: Build and Test
3
3
on :
4
4
push :
5
5
branches : ["master", "feature/*"]
6
- tags : ["v*"]
6
+ tags : ["v*", "plugin-api-v*" ]
7
7
pull_request_target :
8
8
branches : ["master"]
9
9
19
19
runs-on : ubuntu-latest
20
20
outputs :
21
21
version : ${{ steps.generateVersion.outputs.version }}
22
+ plugin-api-version : ${{ steps.generateVersion.outputs.plugin-api-version }}
22
23
23
24
steps :
24
25
- name : Checkout action file
@@ -33,18 +34,20 @@ jobs:
33
34
id : generateVersion
34
35
shell : pwsh
35
36
run : |
36
- $describe = git describe --long --tags --always
37
- if ($describe -match '^v?(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)-(?<offset>\d+)-g(?<hash>[a-f0-9]+)$') {
38
- if ([int]::Parse($Matches.offset) -eq 0) {
39
- $version = "$($Matches.major).$($Matches.minor).$($Matches.patch)"
37
+ foreach ($tagPrefix in @("", "plugin-api-")) {
38
+ $describe = git describe --long --tags --always --match "$($tagPrefix)v*"
39
+ if ($describe -match "^$($tagPrefix)v?(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)-(?<offset>\d+)-g(?<hash>[a-f0-9]+)`$") {
40
+ if ([int]::Parse($Matches.offset) -eq 0) {
41
+ $version = "$($Matches.major).$($Matches.minor).$($Matches.patch)"
42
+ } else {
43
+ $version = "$($Matches.major).$($Matches.minor).$([int]::Parse($Matches.patch) + 1)-dev.$($Matches.offset)+$($Matches.hash)"
44
+ }
40
45
} else {
41
- $version = "$($Matches.major).$($Matches.minor).$([int]::Parse($Matches.patch) + 1)-dev.$($Matches.offset )+$($Matches.hash) "
46
+ $version = "0.0.0-dev.$(git rev-list HEAD --count )+$describe "
42
47
}
43
- } else {
44
- $ version = "0.0.0-dev.$(git rev-list HEAD --count)+$describe"
48
+ Write-Host "Generated version number$(if ($tagPrefix -eq '') { '' } else { " $tagPrefix" } ): $version"
49
+ echo "$($tagPrefix) version=$($version)" >> $Env:GITHUB_OUTPUT
45
50
}
46
- Write-Host "Generated version number: $version"
47
- echo "version=$($version)" >> $Env:GITHUB_OUTPUT
48
51
49
52
buildOnLinux :
50
53
name : Build on Linux
@@ -176,19 +179,19 @@ jobs:
176
179
- name : Build and pack NuGetForUnity.PluginAPI
177
180
run : >-
178
181
dotnet pack ./src/NuGetForUnity.PluginAPI/NuGetForUnity.PluginAPI.csproj --nologo -c Release -o .
179
- -p:Version=${{ needs.determineVersionNumber.outputs.version }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
182
+ -p:Version=${{ needs.determineVersionNumber.outputs.plugin-api- version }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
180
183
-p:ContinuousIntegrationBuild=true
181
184
182
185
- name : publish the NuGetForUnity.Cli NuGet package
183
- if : github.ref_type == 'tag'
186
+ if : github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
184
187
run : >-
185
- dotnet nuget push ./NuGetForUnity.Cli.${{ needs.determineVersionNumber.outputs.version }}.nupkg --api-key ${{secrets.NUGET_API_TOKEN}}
188
+ dotnet nuget push ./NuGetForUnity.Cli.${{ needs.determineVersionNumber.outputs.version }}.nupkg --api-key ${{ secrets.NUGET_API_TOKEN }}
186
189
--source https://api.nuget.org/v3/index.json
187
190
188
191
- name : publish the NuGetForUnity.PluginAPI NuGet package
189
- if : github.ref_type == 'tag'
192
+ if : github.ref_type == 'tag' && startsWith(github.ref_name, 'plugin-api-v')
190
193
run : >-
191
- dotnet nuget push ./NuGetForUnity.PluginAPI.${{ needs.determineVersionNumber.outputs.version }}.nupkg --api-key ${{secrets.NUGET_API_TOKEN}}
194
+ dotnet nuget push ./NuGetForUnity.PluginAPI.${{ needs.determineVersionNumber.outputs.plugin-api- version }}.nupkg --api-key ${{ secrets.NUGET_API_TOKEN }}
192
195
--source https://api.nuget.org/v3/index.json
193
196
194
197
- name : Upload NuGet packages
0 commit comments