-
Notifications
You must be signed in to change notification settings - Fork 772
122 lines (99 loc) · 4.06 KB
/
post-release.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
name: Complete release
on:
workflow_dispatch:
inputs:
tag:
required: true
description: 'Release tag'
type: string
release:
types:
- published
issue_comment:
types:
- created
jobs:
automation:
uses: ./.github/workflows/automation.yml
secrets: inherit
push-packages-and-publish-release:
runs-on: ubuntu-latest
needs: automation
if: |
github.event_name == 'issue_comment'
&& github.event.issue.pull_request
&& github.event.issue.locked == true
&& github.event.comment.user.login != needs.automation.outputs.username
&& contains(github.event.comment.body, '/PushPackages')
&& startsWith(github.event.issue.title, '[release] Prepare release ')
&& github.event.issue.pull_request.merged_at
&& needs.automation.outputs.enabled
env:
GH_TOKEN: ${{ secrets[needs.automation.outputs.token-secret-name] }}
steps:
- name: check out code
uses: actions/checkout@v4
with:
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
ref: ${{ github.event.repository.default_branch }}
- name: Push packages and publish release
shell: pwsh
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
run: |
Import-Module .\build\scripts\post-release.psm1
PushPackagesPublishReleaseUnlockAndPostNoticeOnPrepareReleasePullRequest `
-gitRepository '${{ github.repository }}' `
-pullRequestNumber '${{ github.event.issue.number }}' `
-botUserName '${{ needs.automation.outputs.username }}' `
-commentUserName '${{ github.event.comment.user.login }}' `
-artifactDownloadPath '${{ github.workspace }}/artifacts' `
-pushToNuget '${{ secrets.NUGET_TOKEN != '' }}'
post-release-published:
runs-on: ubuntu-latest
needs:
- automation
if: |
needs.automation.outputs.enabled
&& (github.event_name == 'release' || github.event_name == 'workflow_dispatch')
env:
GH_TOKEN: ${{ secrets[needs.automation.outputs.token-secret-name] }}
steps:
- uses: actions/checkout@v4
with:
# Note: By default GitHub only fetches 1 commit. We need all the tags
# for this work.
fetch-depth: 0
ref: ${{ github.event.repository.default_branch }}
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
- name: Setup dotnet
uses: actions/setup-dotnet@v4
- name: Create GitHub Pull Request to update stable build version in props
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'))
|| (inputs.tag && startsWith(inputs.tag, 'core-') && !contains(inputs.tag, '-alpha') && !contains(inputs.tag, '-beta') && !contains(inputs.tag, '-rc'))
shell: pwsh
run: |
Import-Module .\build\scripts\post-release.psm1
CreateStableVersionUpdatePullRequest `
-gitRepository '${{ github.repository }}' `
-tag '${{ inputs.tag || github.ref_name }}' `
-targetBranch '${{ github.event.repository.default_branch }}' `
-gitUserName '${{ needs.automation.outputs.username }}' `
-gitUserEmail '${{ needs.automation.outputs.email }}'
- name: Invoke core version update workflow in opentelemetry-dotnet-contrib repository
if: vars.CONTRIB_REPO
shell: pwsh
run: |
Import-Module .\build\scripts\post-release.psm1
InvokeCoreVersionUpdateWorkflowInRemoteRepository `
-remoteGitRepository '${{ vars.CONTRIB_REPO }}' `
-tag '${{ inputs.tag || github.ref_name }}'
- name: Post notice when release is published
shell: pwsh
run: |
Import-Module .\build\scripts\post-release.psm1
TryPostReleasePublishedNoticeOnPrepareReleasePullRequest `
-gitRepository '${{ github.repository }}' `
-botUserName '${{ needs.automation.outputs.username }}' `
-tag '${{ inputs.tag || github.ref_name }}'