From 45de52ec71bcd2be40a7566f39bc5f4aef251e94 Mon Sep 17 00:00:00 2001 From: Snehil Kishore Date: Thu, 18 Dec 2025 11:37:19 +0530 Subject: [PATCH 1/6] feat: add v5 CI and publish workflows --- .github/workflows/v5-ci.yml | 40 ++++++++++++ .github/workflows/v5-publish.yml | 104 +++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 .github/workflows/v5-ci.yml create mode 100644 .github/workflows/v5-publish.yml diff --git a/.github/workflows/v5-ci.yml b/.github/workflows/v5-ci.yml new file mode 100644 index 00000000..88eb739f --- /dev/null +++ b/.github/workflows/v5-ci.yml @@ -0,0 +1,40 @@ +name: ci + +on: + push: + branches: + - v5 +jobs: + compile: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Bootstrap poetry + run: | + curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1 + - name: Install dependencies + run: poetry install + - name: Compile + run: poetry run mypy . + test: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Bootstrap poetry + run: | + curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1 + - name: Install dependencies + run: poetry install + + - name: Test + run: poetry run pytest -rP . diff --git a/.github/workflows/v5-publish.yml b/.github/workflows/v5-publish.yml new file mode 100644 index 00000000..c777edc9 --- /dev/null +++ b/.github/workflows/v5-publish.yml @@ -0,0 +1,104 @@ +name: Publish Release (v5) + +on: + workflow_dispatch: + inputs: + environment: + description: 'Target environment' + type: choice + required: true + options: + - testpypi + - pypi + default: 'testpypi' + +permissions: + contents: write + id-token: write + +jobs: + publish-pypi: + name: "PyPI" + runs-on: ubuntu-latest + environment: ${{ github.event.inputs.environment }} + + steps: + - name: Checkout code + uses: actions/checkout@v5 + with: + fetch-depth: 0 + fetch-tags: true + + - id: get_version + name: Get version from pyproject.toml + run: | + VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/') + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Version: $VERSION" + + - id: get_prerelease + name: Determine if pre-release + run: | + VERSION="${{ steps.get_version.outputs.version }}" + if [[ "$VERSION" =~ (a|alpha|b|beta|rc)[0-9]* ]]; then + echo "prerelease=true" >> $GITHUB_OUTPUT + echo "Pre-release: true" + else + echo "prerelease=false" >> $GITHUB_OUTPUT + echo "Stable release" + fi + + - name: Create GitHub Release + if: github.event.inputs.environment == 'pypi' + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.get_version.outputs.version }} + release_name: v${{ steps.get_version.outputs.version }} + body: | + See [v5_MIGRATION_GUIDE.md](https://github.com/${{ github.repository }}/blob/main/v5_MIGRATION_GUIDE.md) for migration instructions. + draft: false + prerelease: ${{ steps.get_prerelease.outputs.prerelease }} + + - name: Configure Python + uses: actions/setup-python@v6 + with: + python-version: "3.10" + + - name: Configure dependencies + run: | + pip install --user --upgrade pip + pip install --user pipx + pipx ensurepath + pipx install poetry + poetry config virtualenvs.in-project true + poetry install + + - name: Build release + run: | + poetry build + ls -lh dist/ + + - name: Publish to Test PyPI + if: github.event.inputs.environment == 'testpypi' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + skip-existing: true + print-hash: true + + - name: Publish to PyPI + if: github.event.inputs.environment == 'pypi' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + print-hash: true + + - name: Summary + run: | + echo "### Release Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "- Version: ${{ steps.get_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY + echo "- Environment: ${{ github.event.inputs.environment }}" >> $GITHUB_STEP_SUMMARY + echo "- Pre-release: ${{ steps.get_prerelease.outputs.prerelease }}" >> $GITHUB_STEP_SUMMARY From 9ef78ecc20eb9076f53fb28ff4471ac83bac77fc Mon Sep 17 00:00:00 2001 From: Snehil Kishore Date: Thu, 18 Dec 2025 11:41:07 +0530 Subject: [PATCH 2/6] Changing the workflow name --- .github/workflows/v5-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/v5-ci.yml b/.github/workflows/v5-ci.yml index 88eb739f..84925d2e 100644 --- a/.github/workflows/v5-ci.yml +++ b/.github/workflows/v5-ci.yml @@ -1,4 +1,4 @@ -name: ci +name: Test (v5) on: push: From 3dcef7f4191f3f9b339e554547825d37f4ed4411 Mon Sep 17 00:00:00 2001 From: Snehil Kishore Date: Thu, 18 Dec 2025 11:45:18 +0530 Subject: [PATCH 3/6] Testing changes --- .github/workflows/v5-publish.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/v5-publish.yml b/.github/workflows/v5-publish.yml index c777edc9..992348b1 100644 --- a/.github/workflows/v5-publish.yml +++ b/.github/workflows/v5-publish.yml @@ -11,6 +11,9 @@ on: - testpypi - pypi default: 'testpypi' + pull_request: + branches: + - main permissions: contents: write @@ -20,7 +23,7 @@ jobs: publish-pypi: name: "PyPI" runs-on: ubuntu-latest - environment: ${{ github.event.inputs.environment }} + environment: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'testpypi' }} steps: - name: Checkout code @@ -49,7 +52,7 @@ jobs: fi - name: Create GitHub Release - if: github.event.inputs.environment == 'pypi' + if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi' id: create_release uses: actions/create-release@v1 env: @@ -80,20 +83,22 @@ jobs: run: | poetry build ls -lh dist/ + echo "Build successful! Artifacts created:" + ls -lh dist/ - name: Publish to Test PyPI - if: github.event.inputs.environment == 'testpypi' + if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testpypi' uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ skip-existing: true print-hash: true - - name: Publish to PyPI - if: github.event.inputs.environment == 'pypi' - uses: pypa/gh-action-pypi-publish@release/v1 - with: - print-hash: true + # - name: Publish to PyPI + # if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi' + # uses: pypa/gh-action-pypi-publish@release/v1 + # with: + # print-hash: true - name: Summary run: | From 24b5972d7b425e52b273bbc8f0c74379b5f8a5cc Mon Sep 17 00:00:00 2001 From: Snehil Kishore Date: Thu, 18 Dec 2025 11:53:31 +0530 Subject: [PATCH 4/6] Snyk changes --- .github/workflows/v5-ci.yml | 3 +++ .github/workflows/v5-publish.yml | 2 +- requirements.txt | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/v5-ci.yml b/.github/workflows/v5-ci.yml index 84925d2e..a1305045 100644 --- a/.github/workflows/v5-ci.yml +++ b/.github/workflows/v5-ci.yml @@ -4,6 +4,9 @@ on: push: branches: - v5 + pull_request: + branches: + - master jobs: compile: runs-on: ubuntu-latest diff --git a/.github/workflows/v5-publish.yml b/.github/workflows/v5-publish.yml index 992348b1..5efeb863 100644 --- a/.github/workflows/v5-publish.yml +++ b/.github/workflows/v5-publish.yml @@ -13,7 +13,7 @@ on: default: 'testpypi' pull_request: branches: - - main + - master permissions: contents: write diff --git a/requirements.txt b/requirements.txt index f0f28bfe..e1ae8bd3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,7 +35,7 @@ responses==0.23.3 ; python_version >= "3.7" and python_version < "4.0" tomli==2.2.1 ; python_version >= "3.7" and python_full_version <= "3.11.0a6" types-pyyaml==6.0.12.20250915 ; python_version >= "3.7" and python_version < "4.0" typing-extensions==4.7.1 ; python_version >= "3.7" and python_version < "3.8" -urllib3==2.5.0 ; python_version >= "3.7" and python_version < "4.0" +urllib3==2.6.0 ; python_version >= "3.7" and python_version < "4.0" userpath==1.9.2 ; python_version >= "3.7" and python_version < "4.0" yarl==1.20.0 ; python_version >= "3.7" and python_version < "4.0" zipp==3.19.1 ; python_version >= "3.7" and python_version < "3.8" From 9ec2ce619fbd88613aa0968b28362598bddb34bc Mon Sep 17 00:00:00 2001 From: Snehil Kishore Date: Thu, 18 Dec 2025 12:01:33 +0530 Subject: [PATCH 5/6] test on v5 branch code --- .github/workflows/v5-ci.yml | 4 ++++ .github/workflows/v5-publish.yml | 1 + 2 files changed, 5 insertions(+) diff --git a/.github/workflows/v5-ci.yml b/.github/workflows/v5-ci.yml index a1305045..a52e6da2 100644 --- a/.github/workflows/v5-ci.yml +++ b/.github/workflows/v5-ci.yml @@ -13,6 +13,8 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4 + with: + ref: v5 - name: Set up python uses: actions/setup-python@v4 with: @@ -29,6 +31,8 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4 + with: + ref: v5 - name: Set up python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/v5-publish.yml b/.github/workflows/v5-publish.yml index 5efeb863..66fbaa3b 100644 --- a/.github/workflows/v5-publish.yml +++ b/.github/workflows/v5-publish.yml @@ -29,6 +29,7 @@ jobs: - name: Checkout code uses: actions/checkout@v5 with: + ref: v5 fetch-depth: 0 fetch-tags: true From 91f4f4c1ae7044e5a80b19578d1b7727833980b7 Mon Sep 17 00:00:00 2001 From: Snehil Kishore Date: Thu, 18 Dec 2025 17:21:40 +0530 Subject: [PATCH 6/6] Reverting the testing changes --- .github/workflows/v5-ci.yml | 6 +----- .github/workflows/v5-publish.yml | 13 ++++++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/v5-ci.yml b/.github/workflows/v5-ci.yml index a52e6da2..90a099a8 100644 --- a/.github/workflows/v5-ci.yml +++ b/.github/workflows/v5-ci.yml @@ -6,15 +6,13 @@ on: - v5 pull_request: branches: - - master + - v5 jobs: compile: runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v4 - with: - ref: v5 - name: Set up python uses: actions/setup-python@v4 with: @@ -31,8 +29,6 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4 - with: - ref: v5 - name: Set up python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/v5-publish.yml b/.github/workflows/v5-publish.yml index 66fbaa3b..82b8b80f 100644 --- a/.github/workflows/v5-publish.yml +++ b/.github/workflows/v5-publish.yml @@ -13,7 +13,7 @@ on: default: 'testpypi' pull_request: branches: - - master + - v5 permissions: contents: write @@ -29,7 +29,6 @@ jobs: - name: Checkout code uses: actions/checkout@v5 with: - ref: v5 fetch-depth: 0 fetch-tags: true @@ -95,11 +94,11 @@ jobs: skip-existing: true print-hash: true - # - name: Publish to PyPI - # if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi' - # uses: pypa/gh-action-pypi-publish@release/v1 - # with: - # print-hash: true + - name: Publish to PyPI + if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + print-hash: true - name: Summary run: |