-
Notifications
You must be signed in to change notification settings - Fork 35
130 lines (126 loc) · 4.15 KB
/
dotnet.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: .NET
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
ReleaseVersion:
description: 'Release Version'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
3.1.x
6.0.x
7.0.x
8.0.x
- name: Build
run: dotnet build src
- name: Test
run: dotnet test src --no-build --verbosity normal
- name: Pack
run: dotnet pack src --output nuget /p:ReleaseVersion=${{ github.event.inputs.ReleaseVersion }}
- name: Get package version
shell: pwsh
id: vars
run: |
$name = (gci nuget/*.nupkg -Recurse)[0].Name
$version = $name.Substring($name.IndexOf(".") + 1)
$version = $version.Substring(0, $version.LastIndexOf("."))
Write-Output "PackageVersion=$version" | Out-File "${env:GITHUB_OUTPUT}" -Append
- name: Pack
run: |
cd src/Jab.Unity
npm version ${{ steps.vars.outputs.PackageVersion }} --allow-same-version
npm pack --pack-destination=../../nuget
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: nuget
path: nuget/
outputs:
PackageVersion: ${{ steps.vars.outputs.PackageVersion }}
test:
needs: build
strategy:
matrix:
sdk:
- 6.0.x
- 7.x
- 8.x
# https://github.com/microsoft/MSBuildSdks/issues/412
# sdk: [6.0.x, 7.0.x]
include:
- sdk: 6.0.x
tfm: net6.0
- sdk: 7.x
tfm: net7.0
- sdk: 8.x
tfm: net8.0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
with:
name: nuget
path: nuget
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.sdk }}
- name: Get package version
shell: pwsh
id: vars
run: |
$name = (gci nuget/*.nupkg -Recurse)[0].Name
$version = $name.Substring($name.IndexOf(".") + 1)
$version = $version.Substring(0, $version.LastIndexOf("."))
Write-Output "FunctionalTestPackageVersion=$version" | Out-File "${env:GITHUB_OUTPUT}" -Append
- name: Test
run: dotnet test eng/FunctionaTests.proj /p:FunctionalTestTargetFrameworks=${{ matrix.tfm }} /p:RestoreAdditionalProjectSources=${{ github.workspace }}/nuget /p:FunctionalTestPackageVersion=${{ needs.build.outputs.PackageVersion }}
publish:
if: (github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'
needs: [build, test]
runs-on: ubuntu-latest
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
with:
name: nuget
path: nuget
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Publish unity packages to npm
shell: pwsh
run: |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_KEY }}
npm whoami
npm publish ./nuget/com.pakrym.jab-${{ needs.build.outputs.PackageVersion }}.tgz
- name: Add GitHub package source
run: dotnet nuget add source https://nuget.pkg.github.com/pakrym/index.json --name "github" --username NotUsed --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
- name: Publish NuGet packages to NuGet
run: dotnet nuget push nuget/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source "nuget.org" --skip-duplicate --no-symbols
update_versions:
needs: [build, publish]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update package versions in the repo
shell: pwsh
run: ./eng/UpdateAllVersions.ps1 ${{ needs.build.outputs.PackageVersion }} ${{ github.workspace }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
title: Update sample versions
branch: update-versions