-
Notifications
You must be signed in to change notification settings - Fork 17
Automatic publishing on PyPI on new release #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
98883c4
adding version to __init__.py
adamamer20 9ea64f7
add publishing GH Action
adamamer20 7957943
updating pyproject.toml
adamamer20 34689a0
updating the GH Action
adamamer20 5abfd7d
Revert "updating the GH Action"
adamamer20 d5b57e8
updating dependencies
adamamer20 26f0747
updating dependencies on documentation
adamamer20 6e41f94
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 99fab58
adding edited to yml
adamamer20 2cb8358
Merge branch '76-automatic-publishing-on-pypi-on-release' of https://…
adamamer20 1614f1f
pypa publishing action
adamamer20 d85aaac
fix: mesa-frames version
adamamer20 4ed04fe
fix: add version to dynamic
adamamer20 0f66196
fix topic
adamamer20 5d2112b
Merge branch 'main' of https://github.com/adamamer20/mesa-frames into…
adamamer20 50495c6
adding creation of version branch
adamamer20 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: Update Version, Test, Publish to PyPI, and Upload Release Artifacts | ||
|
|
||
| on: | ||
| release: | ||
| types: [created, edited] | ||
|
|
||
| jobs: | ||
| build-test-publish-upload: | ||
| runs-on: ubuntu-latest | ||
| environment: release | ||
| permissions: | ||
| # IMPORTANT: this permission is mandatory for trusted publishing | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.x' | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install hatch | ||
| - name: Set release version | ||
| run: | | ||
| # Get the tag from the GitHub release | ||
| TAG=${GITHUB_REF#refs/tags/} | ||
| # Remove 'v' prefix if present | ||
| VERSION=${TAG#v} | ||
| hatch version $VERSION | ||
| - name: Build package | ||
| run: hatch build | ||
| - name: Run tests | ||
| run: hatch run test:pytest | ||
| - name: Publish package to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| - name: Verify PyPI Release | ||
| run: | | ||
| # Verify PyPI release | ||
| PACKAGE_NAME="mesa_frames" | ||
| CURRENT_VERSION=$(hatch version) | ||
| pip install $PACKAGE_NAME==$CURRENT_VERSION | ||
| python -c "import mesa_frames; print(mesa_frames.__version__)" | ||
| - name: Create or recreate version branch | ||
| - name: Create or recreate version branch | ||
| run: | | ||
| CURRENT_VERSION=$(hatch version) | ||
| BRANCH_NAME="v$CURRENT_VERSION" | ||
|
|
||
| git config user.name github-actions | ||
| git config user.email github-actions@github.com | ||
|
|
||
| # Delete the branch if it exists (both locally and remotely) | ||
| git branch -D $BRANCH_NAME || true | ||
| git push origin --delete $BRANCH_NAME || true | ||
|
|
||
| # Create and push the new branch | ||
| git checkout -b $BRANCH_NAME | ||
| git push -u origin $BRANCH_NAME | ||
|
|
||
| # Switch back to the main branch | ||
| git checkout main | ||
| - name: Update to Next Version | ||
| run: | | ||
| # Bump to next development version | ||
| hatch version patch | ||
| hatch version dev | ||
|
|
||
| # Get the new version | ||
| NEW_VERSION=$(hatch version) | ||
|
|
||
| # Commit and push the version bump | ||
| git config user.name github-actions | ||
| git config user.email github-actions@github.com | ||
| git add mesa-frames/__init__.py | ||
| git commit -m "Bump version to $NEW_VERSION [skip ci]" | ||
| git push | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,3 +57,5 @@ def __init__(self, width, height): | |
| "GridPandas", | ||
| "GridPolars", | ||
| ] | ||
|
|
||
| __version__ = "0.1.0alpha" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.