-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add GitHub action for publishing artifacts to PyPI #5244
Merged
Merged
Changes from 7 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
eecf2e9
Add GitHub action for publishing artifacts to PyPI
andersy005 f62aa07
Attempt at installing built artifacts
andersy005 15dc8fe
Add job for publishing to PyPI
andersy005 652c1e3
Remove git describe and put fetch-depth back
andersy005 9217924
remove fetch-depth
andersy005 1abd629
Remove push and pull_request event triggers
andersy005 f6c808b
Merge branch 'master' of github.com:pydata/xarray into pypi-release-v…
andersy005 a9c5da0
[skip-ci] Use python -m build
andersy005 1b9544c
[skip-ci] Set user to __token__
andersy005 5d201da
[skip-ci] Fetch all history
andersy005 73f0467
[skip-ci] Remove debugging push event trigger
andersy005 01ff602
[skip-ci] Use single job
andersy005 a97181e
Merge branch 'master' of github.com:pydata/xarray into pypi-release-v…
andersy005 43d8ed7
Add step for uploading to testPyPI
andersy005 844016b
[skip-ci] Disable if for debugging
andersy005 f503198
Remove debugging statements
andersy005 c44638f
[skip-ci]
andersy005 e883bf1
Fix github.event_name
andersy005 f6e3153
[skip-ci]
andersy005 a4607b1
Install uploaded package
andersy005 b622462
[skip-ci]
andersy005 7398dd8
[skip-ci] Move TestPyPI steps in `test-built-dist` job
andersy005 7cb71e7
[skip-ci] Make `if` condition global
andersy005 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 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,84 @@ | ||
name: Build and Upload xarray to PyPI | ||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
|
||
|
||
jobs: | ||
build-artifacts: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
name: Install Python | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install setuptools setuptools-scm wheel twine check-manifest | ||
|
||
- name: Build tarball and wheels | ||
run: | | ||
git clean -xdf | ||
git restore -SW . | ||
python setup.py sdist bdist_wheel | ||
python -m pip wheel . -w dist --no-deps | ||
andersy005 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Test the artifacts | ||
run: | | ||
python -m twine check dist/* | ||
pwd | ||
if [ -f dist/xarray-0.0.0.tar.gz ]; then | ||
echo "❌ INVALID VERSION NUMBER" | ||
exit 1 | ||
else | ||
echo "✅ Looks good" | ||
fi | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: releases | ||
path: dist | ||
|
||
test-built-dist: | ||
needs: build-artifacts | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-python@v2 | ||
name: Install Python | ||
with: | ||
python-version: 3.8 | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: releases | ||
path: dist | ||
- name: List contents of built dist | ||
run: | | ||
ls -ltrh | ||
ls -ltrh dist | ||
|
||
- name: Install built artifacts | ||
run: | | ||
python -m pip install dist/*.tar.gz | ||
|
||
upload-to-pypi: | ||
needs: build-artifacts | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | ||
andersy005 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: releases | ||
path: dist | ||
|
||
- name: Publish package to PyPI | ||
uses: pypa/gh-action-pypi-publish@v1.4.2 | ||
andersy005 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
user: ${{ secrets.PYPI_USERNAME }} | ||
password: ${{ secrets.PYPI_PASSWORD }} | ||
andersy005 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
skip_existing: true | ||
verbose: true |
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.
I usually use
created
here, but this probably doesn't make much of a difference since we don't use "draft releases" (and I can't seem to find a page which explains the difference between the "activity types")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.
Not sure if you've seen this page already. There's this note: