-
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (67 loc) · 2.07 KB
/
version-bump.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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Version bump
on:
workflow_dispatch:
inputs:
versionPart:
description: 'Version bump part'
required: true
default: patch
type: choice
options:
- patch
- minor
- major
workflow_call:
inputs:
versionPart:
description: 'Version bump part'
required: true
type: string
projectDir:
description: 'Project directory where the pyproject.toml is located'
required: false
type: string
default: '.'
jobs:
deploy:
name: Version bump on release branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.3.0
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip pipx
- name: Setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git checkout -b release
- name: Bumpversion
run: |
set -e
pipx run --spec git+/~https://github.com/bulv1ne/poetry-bumpversion poetry-bumpversion ${{ inputs.versionPart }} --project-dir ${{ inputs.projectDir || '.' }}
- name: Git push
run: |
git push origin release --force
- name: Create Pull Request
uses: actions/github-script@v7
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'Release version',
owner,
repo,
head: 'release',
base: '${{ github.event.repository.default_branch }}',
body: [
'This PR is auto-generated by',
'[actions/github-script](/~https://github.com/actions/github-script).'
].join('\n')
});