forked from open-telemetry/opentelemetry-dotnet-contrib
71 lines (56 loc) · 2.44 KB
/
Component.Package.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
name: Pack Component
on:
workflow_call:
inputs:
project-name:
required: true
type: string
jobs:
build-test-pack:
permissions:
contents: write
pull-requests: write
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetching all
- name: Setup dotnet
uses: actions/setup-dotnet@v4
- name: dotnet restore build/Projects/${{ inputs.project-name }}.proj
run: dotnet restore build/Projects/${{ inputs.project-name }}.proj -p:EnablePackageValidation=true
- name: dotnet build build/Projects/${{ inputs.project-name }}.proj
run: dotnet build build/Projects/${{ inputs.project-name }}.proj --configuration Release --no-restore -p:Deterministic=true -p:BuildNumber=${{ github.run_number }}
- name: dotnet test build/Projects/${{ inputs.project-name }}.proj
run: dotnet test build/Projects/${{ inputs.project-name }}.proj --configuration Release --no-restore --no-build
- name: dotnet pack build/Projects/${{ inputs.project-name }}.proj
run: dotnet pack build/Projects/${{ inputs.project-name }}.proj --configuration Release --no-restore --no-build -p:EnablePackageValidation=true
- name: Publish Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.project-name }}.proj-packages
path: 'src/*/bin/Release/*.*nupkg'
- name: Publish NuGets
env:
NUGET_TOKEN_EXISTS: ${{ secrets.NUGET_TOKEN != '' }}
if: env.NUGET_TOKEN_EXISTS == 'true' # Skip NuGet publish if run on a fork without the secret
run: |
nuget push src/*/bin/Release/*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_TOKEN }} -SymbolApiKey ${{ secrets.NUGET_TOKEN }}
- name: Create GitHub Release
shell: pwsh
run: |
Import-Module .\build\scripts\post-release.psm1
CreateRelease `
-tag '${{ github.ref_name }}'
env:
GH_TOKEN: ${{ github.token }}
- name: Create GitHub Pull Request to update PackageValidationBaselineVersion in projects
if: |
!contains(github.ref_name, '-alpha') && !contains(github.ref_name, '-beta') && !contains(github.ref_name, '-rc')
shell: pwsh
run: |
Import-Module .\build\scripts\post-release.psm1
CreatePackageValidationBaselineVersionUpdatePullRequest `
-tag '${{ github.ref_name }}'
env:
GH_TOKEN: ${{ github.token }}