Merge pull request #3459 from newrelic/dev #148
This file contains hidden or 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: Generate Release Notes | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| send-pull-requests: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: ruby/setup-ruby@8d27f39a5e7ad39aebbcbd1324f7af020229645c # tag v1.287.0 | |
| with: | |
| ruby-version: 3.4 | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # tag v6.0.2 | |
| - 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # tag v6.0.2 | |
| - 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # tag v6.0.2 | |
| with: | |
| token: ${{ secrets.NEWRELIC_RUBY_AGENT_BOT_TOKEN }} | |
| repository: newrelic/docs-website | |
| - 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}} |