forked from aws-powertools/powertools-lambda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (36 loc) · 1.46 KB
/
reusable_publish_changelog.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
name: Build and publish latest changelog
on:
workflow_call:
permissions:
contents: write
env:
BRANCH: develop
jobs:
publish_changelog:
# Force Github action to run only a single job at a time (based on the group name)
# This is to prevent race-condition and inconsistencies with changelog push
concurrency:
group: changelog-build
runs-on: ubuntu-latest
steps:
- name: Checkout repository # reusable workflows start clean, so we need to checkout again
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
- name: Git client setup and refresh tip
run: |
git config user.name "Release bot"
git config user.email "[email protected]"
git config pull.rebase true
git config remote.origin.url >&- || git remote add origin https://github.com/"${origin}" # Git Detached mode (release notes) doesn't have origin
git pull origin "${BRANCH}"
- name: "Generate latest changelog"
run: make changelog
- name: Update Changelog in trunk
run: |
HAS_CHANGE=$(git status --porcelain)
test -z "${HAS_CHANGE}" && echo "Nothing to update" && exit 0
git add CHANGELOG.md
git commit -m "update changelog with latest changes"
git pull origin "${BRANCH}" # prevents concurrent branch update failing push
git push origin HEAD:refs/heads/"${BRANCH}"