Skip to content

Commit ee072dd

Browse files
Huzaif Mushtaq MirHuzaif Mushtaq Mir
authored andcommitted
ci: automate bump PR
1 parent d798898 commit ee072dd

2 files changed

Lines changed: 25 additions & 13 deletions

File tree

.github/workflows/python-publish.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,10 @@ jobs:
3131
run: |
3232
python setup.py sdist bdist_wheel
3333
twine upload dist/*
34+
35+
- name: Extract version and create tag
36+
run: |
37+
VERSION=$(sed -n 's/^[[:space:]]*version="\([^"]*\)".*/\1/p' setup.py)
38+
39+
git tag "$VERSION" 2>/dev/null || echo "Tag already exists"
40+
git push origin "$VERSION" || true

.github/workflows/update-version.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ on:
1515
jobs:
1616
update-version:
1717
runs-on: ubuntu-latest
18+
env:
19+
LIBRARY_VERSION: ${{ github.event.inputs.libraryVersion }}
20+
PACKAGE_VERSION: ${{ github.event.inputs.packageVersion }}
1821
steps:
1922
- name: Checkout code
2023
uses: actions/checkout@v2
@@ -24,19 +27,21 @@ jobs:
2427

2528
- name: Update Package Version
2629
run: |
27-
sed -i '/version=/!b;c \ \ \ \ version="${{ github.event.inputs.packageVersion }}",' setup.py
30+
sed -i -E 's/^([[:space:]]*)version="[^"]*"/\1version="${{ env.PACKAGE_VERSION }}"/' setup.py
2831
2932
- name: Update Library Version
3033
run: |
31-
sed -i '/lexfloatclient_libs_version =/!b;clexfloatclient_libs_version = "v${{ github.event.inputs.libraryVersion }}"' pre-publish.py
32-
33-
- name: Commit, Tag and Push
34-
run: |
35-
git add pre-publish.py
36-
git add setup.py
37-
git config user.name github-actions
38-
git config user.email github-actions@github.com
39-
git commit -m "updated version" | exit 0
40-
git tag ${{ github.event.inputs.packageVersion }}
41-
git push --set-upstream origin release/${{ github.event.inputs.packageVersion }}
42-
git push --tags
34+
sed -i -E 's/^([[:space:]]*lexfloatclient_libs_version[[:space:]]*=[[:space:]]*)"[^"]*"/\1"v${{ env.LIBRARY_VERSION }}"/' pre-publish.py
35+
36+
- name: Create Pull Request
37+
uses: peter-evans/create-pull-request@v5
38+
with:
39+
branch: ci/${{ env.PACKAGE_VERSION }}
40+
title: "chore: bump package version to ${{ env.PACKAGE_VERSION }}"
41+
commit-message: "chore(package version): updated version"
42+
body: |
43+
Automated package version bump.
44+
base: master
45+
add-paths: |
46+
pre-publish.py
47+
setup.py

0 commit comments

Comments
 (0)