-
Notifications
You must be signed in to change notification settings - Fork 69
104 lines (93 loc) · 4.25 KB
/
Copy pathpublish_release_notes.yml
File metadata and controls
104 lines (93 loc) · 4.25 KB
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
name: Publish .NET Agent Release Notes
on:
workflow_dispatch:
inputs:
agent_version:
description: 'Agent version that was released. Needs to match the version from the Deploy Agent workflow (deploy_agent.yml). Format: X.X.X'
required: true
type: string
run_id:
description: 'Run ID of the Release Workflow (all_solutions.yml) that was triggered by creating a Release in GitHub. ID can be found in URL for run.'
required: true
type: string
workflow_call:
inputs:
agent_version:
description: 'Agent Version to deploy. Needs to match the version from the Release Workflow (all_solutions.yml). Format: X.X.X'
required: true
type: string
run_id:
description: 'Run ID of the Release Workflow (all_solutions.yml) that was triggered by creating a Release in GitHub. ID can be found in URL for run.'
required: true
type: string
permissions:
contents: read
packages: read
env:
DOTNET_NOLOGO: true
jobs:
publish-release-notes:
name: Create and Publish Release Notes
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Install latest .NET 10 SDK
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
with:
dotnet-version: '10.0.x'
dotnet-quality: 'ga'
- name: Download Deploy Artifacts
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.run_id }}
name: deploy-artifacts
path: ${{ github.workspace }}/deploy-artifacts
repository: ${{ github.repository }}
- name: Set Docs PR Branch Name
run: |
cleaned_branch=$(echo "${{ inputs.agent_version }}" | sed 's/\./-/g')
echo "branch_name=dotnet-release-$cleaned_branch"
echo "branch_name=dotnet-release-$cleaned_branch" >> $GITHUB_ENV
shell: bash
- name: Build Release Notes
run: |
dotnet publish --configuration Release --output "$PUBLISH_PATH" "$BUILD_PATH"
notes_file=$("$PUBLISH_PATH/ReleaseNotesBuilder" -p "$PUBLISH_PATH/data.yml" -c "$CHANGELOG" -x "$CHECKSUMS" -o "$OUTPUT_PATH")
echo "$notes_file"
echo "notes_file=$notes_file" >> $GITHUB_ENV
shell: bash
env:
BUILD_PATH: ${{ github.workspace }}/build/ReleaseNotesBuilder/ReleaseNotesBuilder.csproj
PUBLISH_PATH: ${{ github.workspace }}/build/ReleaseNotesBuilder/publish
CHANGELOG: ${{ github.workspace }}/src/Agent/CHANGELOG.md
CHECKSUMS: ${{ github.workspace }}/deploy-artifacts/DownloadSite/SHA256/checksums.md
OUTPUT_PATH: ${{ github.workspace }}
- name: Create branch
uses: dmnemec/copy_file_to_another_repo_action@c93037aa10fa8893de271f19978c980d0c1a9b37 # tag v1.1.1
env:
API_TOKEN_GITHUB: ${{ secrets.DOTNET_AGENT_GH_TOKEN }}
with:
source_file: "${{ env.notes_file }}"
destination_repo: 'newrelic/docs-website'
destination_folder: 'src/content/docs/release-notes/agent-release-notes/net-release-notes'
user_email: '${{ secrets.BOT_EMAIL }}'
user_name: 'dotnet-agent-team-bot'
destination_branch: 'develop'
destination_branch_create: ${{env.branch_name}}
commit_message: 'chore(.net agent): Add .NET Agent release notes for v${{ inputs.agent_version }}.'
- name: Create pull request
run: gh pr create --base "develop" --repo "$REPO" --head "$HEAD" --title "$TITLE" --body "$BODY"
env:
GH_TOKEN: ${{ secrets.DOTNET_AGENT_GH_TOKEN }}
REPO: https://github.com/newrelic/docs-website/
HEAD: ${{env.branch_name}}
TITLE: ".NET Agent Release Notes for v${{ inputs.agent_version }}"
BODY: "This is an automated PR generated when the .NET agent is released. Please merge as soon as possible."