-
Notifications
You must be signed in to change notification settings - Fork 183
72 lines (69 loc) · 2.61 KB
/
publish.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
# This GH Action is triggered when a release is 'published' in GitHub.
# Once that happens, it will re-generate the Changelog (from the GH tag), and
# update the tag so that it gets picked up by ReadTheDocs.
name: Publish Version
on:
release:
types: [published]
workflow_dispatch:
jobs:
# NOTE: We need to update the CHANGELOG on both the `release/*` and `master`
# branches to ensure they are in sync.
changelog-release-branch:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' }}
steps:
- uses: actions/checkout@v4
- uses: rhysd/changelog-from-release/action@v3
with:
file: CHANGELOG.md
github_token: ${{ secrets.GITHUB_TOKEN }}
commit: false
args: -d=false -l=2
header: "# Changelog\n"
- name: Commiting & Pushing Updated Changelog
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update CHANGELOG.md for ${{ github.event.release.tag_name }}
tagging_message: ${{ github.event.release.tag_name }}
# NOTE: The tag will already exist (created by the release pipeline),
# so we'll need to override it to ensure the tag contains the right
# changelog.
push_options: "--force"
- name: Tagging release as stable
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update CHANGELOG.md for ${{ github.event.release.tag_name }}
tagging_message: stable
# NOTE: The tag will already exist (created by previous releases), so
# we'll need to override it to ensure it points to the latest
# published release.
push_options: "--force"
changelog-master-branch:
runs-on: ubuntu-latest
steps:
# TODO: Open a PR instead of pushing straight to `master`?
- uses: actions/checkout@v4
with:
ref: master
- uses: rhysd/changelog-from-release/action@v3
with:
file: CHANGELOG.md
github_token: ${{ secrets.GITHUB_TOKEN }}
commit: false
args: -d=false -l=2
header: "# Changelog\n\n"
- name: Open PR with Changelog changes
uses: peter-evans/create-pull-request@v6
with:
add-paths: ./CHANGELOG.md
commit-message: Update Changelog
branch: update-changelog
branch-suffix: timestamp
delete-branch: true
title: Update CHANGELOG
body: "
# Updated CHANGELOG\n
This automated PR re-generates the changelog to keep it up to
date."
reviewers: "SeldonIO/mlops"