14
14
- ' core-*'
15
15
- ' coreunstable-*'
16
16
- ' Instrumentation.*-'
17
+ workflow_call :
18
+ inputs :
19
+ tag :
20
+ required : true
21
+ type : string
22
+ outputs :
23
+ artifact-id :
24
+ value : ${{ jobs.build-pack-publish.outputs.artifact-id }}
25
+ artifact-url :
26
+ value : ${{ jobs.build-pack-publish.outputs.artifact-url }}
17
27
schedule :
18
28
- cron : ' 0 0 * * *' # once in a day at 00:00
19
29
@@ -25,14 +35,18 @@ jobs:
25
35
build-pack-publish :
26
36
runs-on : windows-latest
27
37
38
+ outputs :
39
+ artifact-id : ${{ steps.upload-artifacts.outputs.artifact-id }}
40
+ artifact-url : ${{ steps.upload-artifacts.outputs.artifact-url }}
41
+
28
42
steps :
29
43
- uses : actions/checkout@v4
30
44
with :
31
45
# Note: By default GitHub only fetches 1 commit. MinVer needs to find
32
46
# the version tag which is typically NOT on the first commit so we
33
47
# retrieve them all.
34
48
fetch-depth : 0
35
- ref : ${{ github.ref || 'main' }}
49
+ ref : ${{ inputs.tag || github.ref || 'main' }}
36
50
37
51
- name : Setup dotnet
38
52
uses : actions/setup-dotnet@v4
@@ -44,12 +58,13 @@ jobs:
44
58
run : dotnet build OpenTelemetry.proj --configuration Release --no-restore -p:Deterministic=true -p:BuildNumber=${{ github.run_number }} -p:RunningDotNetPack=true
45
59
46
60
- name : dotnet pack
47
- run : dotnet pack OpenTelemetry.proj --configuration Release --no-restore --no-build -p:PackTag=${{ github.ref_type == 'tag' && github.ref_name || '' }}
61
+ run : dotnet pack OpenTelemetry.proj --configuration Release --no-restore --no-build -p:PackTag=${{ github.ref_type == 'tag' && github.ref_name || inputs.tag || '' }}
48
62
49
63
- name : Publish Artifacts
64
+ id : upload-artifacts
50
65
uses : actions/upload-artifact@v4
51
66
with :
52
- name : ${{ github.ref_name }}-packages
67
+ name : ${{ inputs.tag || github.ref_name }}-packages
53
68
path : ' **/bin/**/*.*nupkg'
54
69
55
70
- name : Publish MyGet
61
76
nuget push **/bin/**/*.nupkg -Source https://www.myget.org/F/opentelemetry/api/v2/package
62
77
63
78
- name : Create GitHub Release draft
64
- if : github.ref_type == 'tag'
79
+ if : github.ref_type == 'tag' || inputs.tag
65
80
shell : pwsh
66
81
run : |
67
82
$packages = (Get-ChildItem -Path src/*/bin/Release/*.nupkg).Name
88
103
89
104
foreach ($line in $changelogContent)
90
105
{
91
- if ($line -like "## ${{ github.ref_name }} " -and $started -ne $true)
106
+ if ($line -like "## $packageVersion " -and $started -ne $true)
92
107
{
93
108
$started = $true
94
109
}
@@ -122,24 +137,24 @@ jobs:
122
137
123
138
$content
124
139
125
- See [CHANGELOG](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/src/$packageName/CHANGELOG.md) for details.
140
+ See [CHANGELOG](https://github.com/${{ github.repository }}/blob/${{ inputs.tag || github.ref_name }}/src/$packageName/CHANGELOG.md) for details.
126
141
127
142
"@
128
143
}
129
144
130
145
if ($firstPackageVersion -match '-alpha' -or $firstPackageVersion -match '-beta' -or $firstPackageVersion -match '-rc')
131
146
{
132
- gh release create ${{ github.ref_name }} `
133
- --title ${{ github.ref_name }} `
147
+ gh release create ${{ inputs.tag || github.ref_name }} `
148
+ --title ${{ inputs.tag || github.ref_name }} `
134
149
--verify-tag `
135
150
--notes "$notes" `
136
151
--prerelease `
137
152
--draft
138
153
}
139
154
else
140
155
{
141
- gh release create ${{ github.ref_name }} `
142
- --title ${{ github.ref_name }} `
156
+ gh release create ${{ inputs.tag || github.ref_name }} `
157
+ --title ${{ inputs.tag || github.ref_name }} `
143
158
--verify-tag `
144
159
--notes "$notes" `
145
160
--latest `
@@ -149,20 +164,22 @@ jobs:
149
164
GH_TOKEN : ${{ github.token }}
150
165
151
166
- name : Create GitHub draft Pull Request to update stable build version in props
152
- if : github.ref_type == 'tag' && startsWith(github.ref_name, 'core-') && !contains(github.ref_name, '-alpha') && !contains(github.ref_name, '-beta') && !contains(github.ref_name, '-rc')
167
+ if : |
168
+ (github.ref_type == 'tag' && startsWith(github.ref_name, 'core-') && !contains(github.ref_name, '-alpha') && !contains(github.ref_name, '-beta') && !contains(github.ref_name, '-rc'))
169
+ || (inputs.tag && startsWith(inputs.tag, 'core-') && !contains(inputs.tag, '-alpha') && !contains(inputs.tag, '-beta') && !contains(inputs.tag, '-rc'))
153
170
shell : pwsh
154
171
run : |
155
172
git config user.name "github-actions[bot]"
156
173
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
157
174
158
- git switch --create release/post-stable-${{ github.ref_name }}-update 2>&1 | % ToString
175
+ git switch --create release/post-stable-${{ inputs.tag || github.ref_name }}-update main 2>&1 | % ToString
159
176
if ($LASTEXITCODE -gt 0)
160
177
{
161
178
Write-Error 'git switch failure'
162
179
Return
163
180
}
164
181
165
- $match = [regex]::Match('${{ github.ref_name }}', '.*?-(.*)')
182
+ $match = [regex]::Match('${{ inputs.tag || github.ref_name }}', '.*?-(.*)')
166
183
$packageVersion = $match.Groups[1].Value
167
184
168
185
(Get-Content Directory.Packages.props) `
@@ -183,7 +200,7 @@ jobs:
183
200
Return
184
201
}
185
202
186
- git push -u origin release/post-stable-${{ github.ref_name }}-update 2>&1 | % ToString
203
+ git push -u origin release/post-stable-${{ inputs.tag || github.ref_name }}-update 2>&1 | % ToString
187
204
if ($LASTEXITCODE -gt 0)
188
205
{
189
206
Write-Error 'git push failure'
@@ -205,7 +222,7 @@ jobs:
205
222
--title "[repo] Core stable release $packageVersion updates" `
206
223
--body $body `
207
224
--base main `
208
- --head release/post-stable-${{ github.ref_name }}-update `
225
+ --head release/post-stable-${{ inputs.tag || github.ref_name }}-update `
209
226
--label infra `
210
227
--draft
211
228
env :
0 commit comments