From dcd1e6c6ef5b3b8bd4a369a255f1f787a71b9c0c Mon Sep 17 00:00:00 2001 From: Huzaif Mushtaq Mir Date: Thu, 1 Jan 2026 09:10:21 +0530 Subject: [PATCH 1/3] ci: automate bump PR creation, slack notification --- .github/workflows/python-publish.yml | 52 ++++++++++++++++++++++++++++ .github/workflows/update-version.yml | 44 +++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 .github/workflows/python-publish.yml create mode 100644 .github/workflows/update-version.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..9556025 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,52 @@ +name: Publish cryptlex.lexactivator package + +on: + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - run: git pull origin master --ff-only + + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + + - name: Download Native Libs + run: python pre-publish.py + + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* + + - name: Extract version and create tag + run: | + VERSION=$(sed -n 's/^[[:space:]]*version="\([^"]*\)".*/\1/p' setup.py) + + [ -n "$VERSION" ] || exit 1 + + git tag "$VERSION" 2>/dev/null || echo "Tag already exists" + git push origin "$VERSION" + + - name: Notify slack releases channel + uses: slackapi/slack-github-action@v2.1 + with: + webhook: ${{ secrets.SLACK_RELEASES_PROD_WEBHOOK_URL }} + webhook-type: webhook-trigger + payload: | + status: "${{ job.status }}" + environment: "PRODUCTION" + project: "LexActivator Python" diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml new file mode 100644 index 0000000..dfd8d45 --- /dev/null +++ b/.github/workflows/update-version.yml @@ -0,0 +1,44 @@ +name: Update version + +on: + workflow_dispatch: + inputs: + libraryVersion: + description: 'Library Version' + required: true + default: '' + packageVersion: + description: 'Package Version' + required: true + default: '' + +jobs: + update-version: + runs-on: ubuntu-latest + env: + LIBRARY_VERSION: ${{ github.event.inputs.libraryVersion }} + PACKAGE_VERSION: ${{ github.event.inputs.packageVersion }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Update Package Version + run: | + sed -i '/version=/!b;c \ \ \ \ version="${{ env.PACKAGE_VERSION }}",' setup.py + + - name: Update Library Version + run: | + sed -i '/lexactivator_libs_version =/!b;clexactivator_libs_version = "v${{ env.LIBRARY_VERSION }}"' pre-publish.py + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + branch: release/${{ env.PACKAGE_VERSION }} + title: "chore: bump package version to ${{ env.PACKAGE_VERSION }}" + commit-message: "chore(package version): updated version" + body: | + Automated package version bump. + base: master + add-paths: | + pre-publish.py + setup.py From 5ec68c7d66545eea0ad97853841226d08e162da2 Mon Sep 17 00:00:00 2001 From: Huzaif Mushtaq Mir Date: Thu, 1 Jan 2026 11:53:49 +0530 Subject: [PATCH 2/3] ci: update action versions --- .github/workflows/python-publish.yml | 8 ++++---- .github/workflows/update-version.yml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 9556025..fbbe316 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -7,12 +7,12 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: git pull origin master --ff-only - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: '3.x' @@ -39,10 +39,10 @@ jobs: [ -n "$VERSION" ] || exit 1 git tag "$VERSION" 2>/dev/null || echo "Tag already exists" - git push origin "$VERSION" + git push origin "$VERSION" || true - name: Notify slack releases channel - uses: slackapi/slack-github-action@v2.1 + uses: slackapi/slack-github-action@v2 with: webhook: ${{ secrets.SLACK_RELEASES_PROD_WEBHOOK_URL }} webhook-type: webhook-trigger diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index dfd8d45..65521f9 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -20,15 +20,15 @@ jobs: PACKAGE_VERSION: ${{ github.event.inputs.packageVersion }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Update Package Version run: | - sed -i '/version=/!b;c \ \ \ \ version="${{ env.PACKAGE_VERSION }}",' setup.py + sed -i -E 's/^([[:space:]]*)version="[^"]*"/\1version="${{ env.PACKAGE_VERSION }}"/' setup.py - name: Update Library Version run: | - sed -i '/lexactivator_libs_version =/!b;clexactivator_libs_version = "v${{ env.LIBRARY_VERSION }}"' pre-publish.py + sed -i -E 's/^([[:space:]]*lexactivator_libs_version[[:space:]]*=[[:space:]]*)"[^"]*"/\1"v${{ env.LIBRARY_VERSION }}"/' pre-publish.py - name: Create Pull Request uses: peter-evans/create-pull-request@v5 From 85d5db797327429ebf227ffc4abd7c2235b2846a Mon Sep 17 00:00:00 2001 From: Huzaif Mushtaq Mir Date: Fri, 2 Jan 2026 16:34:21 +0530 Subject: [PATCH 3/3] ci: fix bump branch name --- .github/workflows/update-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index 65521f9..99cf175 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -33,7 +33,7 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: - branch: release/${{ env.PACKAGE_VERSION }} + branch: ci/${{ env.PACKAGE_VERSION }} title: "chore: bump package version to ${{ env.PACKAGE_VERSION }}" commit-message: "chore(package version): updated version" body: |