Publish .NET Agent Release Notes #12
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
name: Publish .NET Agent Release 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@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
disable-sudo: true | |
egress-policy: audit | |
- name: Download Deploy Artifacts | |
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
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@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
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 "${{ github.event.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 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." |