Skip to content

Commit ff747f0

Browse files
spencerugbonginx-seanmoloney
authored andcommitted
Add automatic changelog generation in release workflow (#784)
1 parent ac89aff commit ff747f0

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

.github/workflows/release-branch.yml

+18-10
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ on:
1010
required: true
1111
type: boolean
1212
default: false
13-
createPullRequest:
14-
description: 'Create pull request back into main'
15-
required: true
16-
type: boolean
17-
default: false
1813
uploadJWT:
1914
description: 'Temporary JWT to publish packages to up-ap.nginx.com'
2015
required: true
@@ -125,12 +120,27 @@ jobs:
125120
run: |
126121
sudo apt-get update
127122
sudo apt-get install -y gpgv1 monkeysphere
128-
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
129-
- name: Tag release
123+
go install github.com/goreleaser/nfpm/v2/cmd/[email protected]
124+
- name: Generate Changelog
125+
env:
126+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130127
run: |
128+
git clone https://github.com/nginx/agent-changelog.git
129+
cd ./agent-changelog/source
130+
pip install -r requirements.txt
131+
python agent.py
132+
- name: Push Changelog
133+
run: |
134+
mv agent-changelog/source/changelog.md ./site/content/
135+
131136
git config --global user.name 'github-actions'
132137
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
133138
139+
git add ./site/content/changelog.md
140+
git commit -m "Add generated changelog"
141+
git push origin HEAD:${{ github.ref_name }}
142+
- name: Tag release
143+
run: |
134144
git tag -a "v${{env.VERSION}}" -m "CI Autogenerated"
135145
git tag -a "sdk/v${{env.VERSION}}" -m "CI Autogenerated"
136146
- name: Push Tags
@@ -175,8 +185,6 @@ jobs:
175185
az logout
176186
if: always()
177187
- name: Upload Release Assets
178-
env:
179-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
180188
# clobber overwrites existing assets of the same name
181189
run: |
182190
gh release upload --clobber v${{env.VERSION}} \
@@ -202,7 +210,7 @@ jobs:
202210
}))
203211
console.log(`Release published: ${release.data.html_url}`)
204212
- name: Create Pull Request
205-
if: ${{ inputs.publishPackages == true && inputs.createPullRequest == true }}
213+
if: ${{ inputs.publishPackages == true }}
206214
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
207215
with:
208216
script: |

0 commit comments

Comments
 (0)