-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (60 loc) · 2 KB
/
auto-bump.yaml
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
name: auto-bump
on:
pull_request:
branches:
- develop
- main
types:
- opened
workflow_dispatch:
inputs:
logLevel:
description: "Log level"
required: true
default: "warning"
type: choice
options:
- info
- warning
- debug
jobs:
auto-bump:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bump2version
- name: Setup Git
run: |
git config user.email "[email protected]"
git config user.name "github-actions"
git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }}
- name: Auto bump version
run: |
VERSION=$(bump2version --dry-run --list patch | grep current_version | sed -E 's/.*=//')
BASE_SHA=${{ github.event.pull_request.base.sha }}
echo "Base SHA: $BASE_SHA"
HEAD_SHA=${{ github.event.pull_request.head.sha }}
echo "Head SHA: $HEAD_SHA"
COMMITS=$(git log --pretty=format:%s $BASE_SHA..$HEAD_SHA)
echo "Commits: $COMMITS"
python scripts/auto_bump.py ${{ github.event.pull_request.base.ref }} "$VERSION" "$COMMITS"
git push
- name: Update changelog if targeting main branch
if: ${{ github.event.pull_request.base.ref == 'main' }}
run: |
VERSION=$(bump2version --dry-run --list patch | grep current_version | sed -E 's/.*=//')
bash scripts/changelog_release.sh
git add docs/source/dev_documentation/changelog.md
git commit -m "bump changelog: Unreleased -> ${VERSION}"
git push