@@ -23,14 +23,15 @@ jobs:
2323 name : pypi
2424 permissions :
2525 id-token : write # IMPORTANT: mandatory for trusted publishing
26+ contents : write
2627 steps :
2728 - uses : actions/checkout@v4
2829 - name : Set up Python 3.9
2930 uses : actions/setup-python@v3
3031 with :
3132 python-version : " 3.9"
3233 - name : Install dependencies
33- run : python3 -m pip install setuptools wheel twine semver packaging
34+ run : python3 -m pip install --upgrade setuptools wheel twine semver packaging
3435 - name : Get correct version for TestPyPI release
3536 id : check_version
3637 run : |
@@ -41,11 +42,11 @@ jobs:
4142 echo "Version to be used for TestPyPI release: $NEW_VERSION"
4243 echo "::set-output name=version::$NEW_VERSION"
4344 - name : Update version in setup.py
44- run : sed -i '/#replace_package_version_marker/{n;s/version ="[^"]*"/version ="${{ steps.check_version.outputs.version }}"/;}' setup .py
45+ run : sed -i '/#replace_package_version_marker/{n;s/__version__ ="[^"]*"/__version__ ="${{ steps.check_version.outputs.version }}"/;}' ./dspy/__metadata__ .py
4546 - name : Update version in pyproject.toml
4647 run : sed -i '/#replace_package_version_marker/{n;s/version="[^"]*"/version="${{ steps.check_version.outputs.version }}"/;}' pyproject.toml
4748 - name : Update package name in setup.py
48- run : sed -i '/#replace_package_name_marker/{n;s/name ="[^"]*"/name ="dspy-ai-test"/;}' setup.py
49+ run : sed -i '/#replace_package_name_marker/{n;s/__name__ ="[^"]*"/__name__ ="dspy-ai-test"/;}' ./dspy/__metadata__.py
4950 - name : Update package name in pyproject.toml
5051 run : sed -i '/#replace_package_name_marker/{n;s/name="[^"]*"/name="dspy-ai-test"/;}' pyproject.toml
5152 - name : Build a binary wheel
@@ -62,22 +63,23 @@ jobs:
6263 name : pypi
6364 permissions :
6465 id-token : write # IMPORTANT: mandatory for trusted publishing
66+ contents : write
6567 steps :
6668 - uses : actions/checkout@v4
6769 - name : Set up Python 3.9
6870 uses : actions/setup-python@v3
6971 with :
7072 python-version : " 3.9"
7173 - name : Install dependencies
72- run : python3 -m pip install setuptools wheel twine
74+ run : python3 -m pip install --upgrade setuptools wheel twine
7375 - name : Update version in setup.py (dspy)
74- run : sed -i '/#replace_package_version_marker/{n;s/version ="[^"]*"/version ="${{ needs.extract-tag.outputs.version }}"/;}' setup .py
76+ run : sed -i '/#replace_package_version_marker/{n;s/__version__ ="[^"]*"/__version__ ="${{ needs.extract-tag.outputs.version }}"/;}' ./dspy/__metadata__ .py
7577 - name : Update version in pyproject.toml
7678 run : sed -i '/#replace_package_version_marker/{n;s/version="[^"]*"/version="${{ needs.extract-tag.outputs.version }}"/;}' pyproject.toml
7779 # Publish to dspy
7880 - name : Update package name in setup.py
7981 run : |
80- sed -i '/#replace_package_name_marker/{n;s/name ="[^"]*"/name ="dspy"/;}' setup .py
82+ sed -i '/#replace_package_name_marker/{n;s/__name__ ="[^"]*"/__name__ ="dspy"/;}' ./dspy/__metadata__ .py
8183 - name : Update package name in pyproject.toml
8284 run : sed -i '/#replace_package_name_marker/{n;s/name="[^"]*"/name="dspy"/;}' pyproject.toml
8385 - name : Build a binary wheel
8688 uses : pypa/gh-action-pypi-publish@release/v1 # This requires a trusted publisher to be setup in pypi
8789 with :
8890 attestations : false
89- # Publish to dspy-ai
91+ # Publish to dspy-ai
9092 - name : Update version in setup.py (dspy-ai)
9193 run : sed -i '/#replace_package_version_marker/{n;s/version="[^"]*"/version="${{ needs.extract-tag.outputs.version }}"/;}' ./dspy/.internal_dspyai/setup.py
9294 - name : Update package name in setup.py
@@ -99,4 +101,23 @@ jobs:
99101 - name : Publish distribution 📦 to PyPI (dspy-ai)
100102 uses : pypa/gh-action-pypi-publish@release/v1 # This requires a trusted publisher to be setup in pypi
101103 with :
102- attestations : false
104+ attestations : false
105+ - uses : stefanzweifel/git-auto-commit-action@v5 # auto commit changes to main
106+ with :
107+ commit_message : Update versions
108+ create_branch : true
109+ branch : release-${{ needs.extract-tag.outputs.version }}
110+ - name : Checkout main branch
111+ run : |
112+ git fetch origin
113+ git checkout main
114+ - name : Configure git user
115+ run : |
116+ git config --global user.email "[email protected] " 117+ git config --global user.name "Github Actions"
118+ - name : Merge release branch into main
119+ run : |
120+ git merge --no-ff release-${{ needs.extract-tag.outputs.version }}
121+ - name : Push changes to main
122+ run : |
123+ git push origin main
0 commit comments