1010permissions :
1111 contents : write
1212 id-token : write # Required for trusted publishing
13+ packages : write # Required for GitHub Packages
1314
1415jobs :
1516 generate-docs :
4243 pdoc --version
4344
4445 - name : Increment version
46+ id : version
4547 run : |
4648 if [ ! -f .version ]; then
4749 echo "0.1" > .version
5658 echo "$new_version" > .version
5759 sed -i "s/version=\"[^\"]*\"/version=\"$new_version\"/" setup.py
5860 echo "NEW_VERSION=$new_version" >> $GITHUB_ENV
61+ echo "version=$new_version" >> $GITHUB_OUTPUT
5962
6063 - name : Update setup.py requirements
6164 run : |
@@ -146,6 +149,31 @@ jobs:
146149 run : |
147150 python -m twine upload dist/* --skip-existing
148151
152+ - name : Publish to GitHub Packages
153+ env :
154+ TWINE_USERNAME : ${{ github.actor }}
155+ TWINE_PASSWORD : ${{ secrets.GITHUB_TOKEN }}
156+ run : |
157+ # Configure pip for GitHub Packages
158+ cat > ~/.pypirc << EOF
159+ [distutils]
160+ index-servers =
161+ pypi
162+ github
163+
164+ [pypi]
165+ username = __token__
166+ password = ${{ secrets.PYPI_API_TOKEN }}
167+
168+ [github]
169+ repository = https://maven.pkg.github.com/${{ github.repository_owner }}
170+ username = ${{ github.actor }}
171+ password = ${{ secrets.GITHUB_TOKEN }}
172+ EOF
173+
174+ # Upload to GitHub Packages (will show in Packages section)
175+ python -m twine upload --repository github dist/* --skip-existing || echo "GitHub Packages upload skipped or failed"
176+
149177 - name : Commit and push if changes
150178 run : |
151179 git config --local user.name "Vic-Nas"
@@ -157,6 +185,29 @@ jobs:
157185 if git diff --staged --quiet; then
158186 echo "No changes to commit"
159187 else
160- git commit -m "Auto-generate docs and bump version $NEW_VERSION "
188+ git commit -m "Auto-generate docs and bump version ${{ steps.version.outputs.version }} "
161189 git push
162- fi
190+ fi
191+
192+ - name : Create GitHub Release
193+ uses : softprops/action-gh-release@v1
194+ with :
195+ tag_name : v${{ steps.version.outputs.version }}
196+ name : Release v${{ steps.version.outputs.version }}
197+ body : |
198+ ## 📦 vicutils v${{ steps.version.outputs.version }}
199+
200+ Auto-generated release from vicutils code changes.
201+
202+ ### Installation
203+ ```bash
204+ pip install vicutils==${{ steps.version.outputs.version }}
205+ ```
206+
207+ ### Documentation
208+ Visit [the documentation](https://vic-nas.github.io/PythonSolutions/#vicutils) for usage examples.
209+ files : dist/*
210+ draft : false
211+ prerelease : false
212+ env :
213+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments