-
Notifications
You must be signed in to change notification settings - Fork 94
Add automatic release on PyPI #729
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
2 commits
Select commit
Hold shift + click to select a range
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
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
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,18 @@ | ||
| --- | ||
| name: Bug fix or feature implementation | ||
| about: Create a pull request for changed code | ||
| --- | ||
|
|
||
| <!-- | ||
| Please prefix your PR title with [WIP] for PRs that are still in progress. | ||
| --> | ||
|
|
||
| #### Describe the changes | ||
| The related issue or a description of the bug or feature that this PR addresses. | ||
|
|
||
| #### Tasks | ||
| - [ ] Unit tests added that reproduce the issue or prove feature is working | ||
| - [ ] Fix or feature added | ||
| - [ ] Entry to release notes added | ||
| - [ ] Linter and mypy show no errors | ||
| - [ ] Unit tests passing |
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,8 @@ | ||
| --- | ||
| name: Documentation change | ||
| about: Create a pull request for improved or fixed documentation | ||
| --- | ||
|
|
||
| #### Describe the changes | ||
| A short description of the fixed or improved documentation, and the related | ||
| issue if applicable. |
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,65 @@ | ||
| name: release-deploy | ||
|
|
||
| on: | ||
| release: | ||
| types: [ published ] | ||
|
|
||
| jobs: | ||
|
|
||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: true | ||
| matrix: | ||
| python-version: [ '3.10' ] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| with: | ||
| path: main | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Build package | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install build | ||
| cd main | ||
| echo "RELEASE_VERSION=$(cat pyfakefs/_version.py | cut -d "'" -f 2)" >> $GITHUB_ENV | ||
| python -m build | ||
|
|
||
| - name: Publish package to PyPI | ||
| uses: pypa/gh-action-pypi-publish@master | ||
| with: | ||
| user: __token__ | ||
| password: ${{ secrets.PYPI_TOKEN }} | ||
|
|
||
| - name: Create release docs | ||
| run: | | ||
| python -m pip install wheel | ||
| python -m pip install pytest | ||
| python -m pip install sphinx | ||
| cd main/docs | ||
| make html | ||
|
|
||
| - name: Checkout gh-pages | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| ref: gh-pages | ||
| path: doc | ||
|
|
||
| - name: Copy and commit release documentation | ||
| run: | | ||
| cp -r main/gh-pages/* doc/release | ||
| cd doc | ||
| sed "s/href=\"release\/index.html\">Pyfakefs .*/href=\"release\/index.html\">Pyfakefs $RELEASE_VERSION/" index.html > index1.html | ||
| rm index.html | ||
| mv index1.html index.html | ||
| git config user.name "CI Build" | ||
| git config user.email "pyfakefs@gmail.com" | ||
| git add release/* | ||
| git commit -a -m "Release $RELEASE_VERSION documentation" | ||
| 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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh interesting, the docs are published in gh-pages.
In the future I suggest to use readthedocs.io, which builds the docs automatically for releases and even PRs for preview. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until now, I have always done it this way (including in
pytest-order), but I will have a look at readthedocs in this case, thanks. Not for this release, though...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The preview feature is indeed something I am missing in gh-pages, so I will definitely check this out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, setting up ReadTheDocs is very easy, as it turned out - I will probably change this before the release. Maybe tomorrow if I get to it... The PR preview is too good a feature to miss, and as far as I understand, there is literally nothing to do in the release workflow (apart from removing the GH Pages stuff again). Thanks for the tip!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing!
The preview is not enabled by default, you need to go into advanced settings and enable it:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I noticed this. A bit odd that this cannot be configured in the configuration file...