-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add workflow for creating release notes. (#1824)
- Loading branch information
Showing
2 changed files
with
133 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: Publish .NET Agent Releaase Notes | ||
|
||
on: | ||
workflow_dispatch: | ||
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 | ||
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: | ||
|
||
get-external-artifacts: | ||
name: Get and Publish Deploy Artifacts Locally | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1 | ||
with: | ||
disable-sudo: true | ||
egress-policy: audit | ||
|
||
- name: Download Deploy Artifacts | ||
uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
workflow: all_solutions.yml | ||
run_id: ${{ github.event.inputs.run_id }} | ||
name: deploy-artifacts | ||
path: ${{ github.workspace }} | ||
repo: ${{ github.repository }} | ||
|
||
- name: Upload Deploy Artifacts Locally | ||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | ||
with: | ||
name: deploy-artifacts | ||
path: ${{ github.workspace }}/build/BuildArtifacts | ||
if-no-files-found: error | ||
|
||
publish-release-notes: | ||
needs: get-external-artifacts | ||
name: Create and Publish Release Notes | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: Checkout | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Download Deploy Artifacts | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: deploy-artifacts | ||
path: ${{ github.workspace }}/artifacts | ||
|
||
- name: Set Docs PR Branch Name | ||
run: | | ||
cleaned_branch=$(echo "10.13.0" | 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 build --configuration Release "$BUILD_PATH" | ||
notes_file=$("$RUN_PATH/ReleaseNotesBuilder" -p "$RUN_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 | ||
RUN_PATH: ${{ github.workspace }}/build/ReleaseNotesBuilder/bin/Release/net7.0/ | ||
CHANGELOG: ${{ github.workspace }}/src/Agent/CHANGELOG.md | ||
CHECKSUMS: ${{ github.workspace }}/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${{ github.event.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${{ github.event.inputs.agent_version }}" | ||
BODY: "This is an automated PR generated when the .NET agent is released. Please merge as soon as possible." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters