-
Notifications
You must be signed in to change notification settings - Fork 598
75 lines (64 loc) · 3.01 KB
/
release_notes.yml
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
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@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # tag v1.202.0
with:
ruby-version: 3.3
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag v4.1.7
- 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@692973e3d937129bcbf40652eb9f2f61becf3332 # tag v4.1.7
- 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@692973e3d937129bcbf40652eb9f2f61becf3332 # tag v4.1.7
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}}