Skip to content

Merge pull request #2202 from newrelic/dev #102

Merge pull request #2202 from newrelic/dev

Merge pull request #2202 from newrelic/dev #102

Workflow file for this run

name: Generate Release Notes
on:
push:
branches:
- main
jobs:
send-pull-requests:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: ruby/setup-ruby@7d546f4868fb108ed378764d873683f920672ae2 # tag v1.149.0
with:
ruby-version: 3.2
- name: Checkout code
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag v3.5.0
- name: Generate release notes and environment variables
run: |
ruby -r $PWD/.github/workflows/scripts/generate_release_notes.rb -e GenerateReleaseNotes.new.write_output_file
echo "branch_name=$(ruby -r $PWD/.github/workflows/scripts/generate_release_notes.rb -e GenerateReleaseNotes.new.branch_name)" >> $GITHUB_ENV
- name: Build source file
run: echo "source_file=$PWD/$(ruby -r $PWD/.github/workflows/scripts/generate_release_notes.rb -e GenerateReleaseNotes.new.file_name)" >> $GITHUB_ENV
- name: Create branch
uses: dmnemec/copy_file_to_another_repo_action@c93037aa10fa8893de271f19978c980d0c1a9b37 # tag v1.1.1
env:
API_TOKEN_GITHUB: ${{ secrets.NEWRELIC_RUBY_AGENT_BOT_TOKEN }}
with:
source_file: "${{env.source_file}}"
destination_repo: 'newrelic/docs-website'
destination_folder: 'src/content/docs/release-notes/agent-release-notes/ruby-release-notes'
user_email: '${{ secrets.EMAIL }}'
user_name: 'newrelic-ruby-agent-bot'
destination_branch: 'develop'
destination_branch_create: ${{env.branch_name}}
commit_message: 'chore(ruby agent): add release notes'
- name: Create pull request
run: gh pr create --base "develop" --repo "$REPO" --head "$HEAD" --title "$TITLE" --body "$BODY"
env:
GH_TOKEN: ${{ secrets.NEWRELIC_RUBY_AGENT_BOT_TOKEN }}
REPO: https://github.com/newrelic/docs-website/
HEAD: ${{env.branch_name}}
TITLE: "Ruby Release Notes"
BODY: "This is an automated PR generated when the Ruby agent is released. Please merge as soon as possible."
delete_branch_on_fail:
name: Delete branch on fail
needs: [send-pull-requests]
runs-on: ubuntu-22.04
if: failure()
steps:
- name: Checkout agent repository
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag v3.5.0
- name: Get branch name
run: echo "branch_name=$(ruby -r $PWD/.github/workflows/scripts/generate_release_notes.rb -e GenerateReleaseNotes.new.branch_name)" >> $GITHUB_ENV
- name: Checkout docs website repository
uses: actions/checkout@v3
with:
repository: newrelic/docs-website
token: ${{ secrets.NEWRELIC_RUBY_AGENT_BOT_TOKEN }}
- name: Build delete command
run: echo "delete_file=git push origin --delete ${{env.branch_name}} --force" >> $GITHUB_ENV
- name: Delete branch
run: ${{env.delete_file}}