File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 80
80
with :
81
81
name : distributions
82
82
path : dist/
83
- - name : Upload to PyPI (on tags)
83
+ # Deploy on tags if PYPI_API_TOKEN is defined in the repository secrets.
84
+ # Secrets are not accessible in the if: condition [0], so set an output variable [1]
85
+ # [0] https://github.community/t/16928
86
+ # [1] https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter
87
+ - name : Check for PyPI token on tag
88
+ id : deployable
84
89
if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
90
+ env :
91
+ PYPI_API_TOKEN : " ${{ secrets.PYPI_API_TOKEN }}"
92
+ run : if [ -n "$PYPI_API_TOKEN" ]; then echo ::set-output name=DEPLOY::true; fi
93
+ - name : Upload to PyPI
94
+ if : steps.deployable.outputs.DEPLOY
85
95
uses : pypa/gh-action-pypi-publish@master
86
96
with :
87
97
user : __token__
Original file line number Diff line number Diff line change @@ -35,7 +35,10 @@ python setup.py sdist bdist_wheel
35
35
twine upload dist/*
36
36
```
37
37
38
- Note that we assume tags will be version numbers and not be prefixed with ` v ` or some other
38
+ Note that uploading to PyPI is done via [ Continuous integration] ( #continuous-integration ) ) when
39
+ a tag is pushed to the repository, so only the first step needs to be donne manually.
40
+
41
+ Note also that we assume tags will be version numbers and not be prefixed with ` v ` or some other
39
42
string. See Versioneer documentation for alternative configurations.
40
43
41
44
## Namespace packages
@@ -72,6 +75,10 @@ non-compliant package can potentially affect Pydra or other task packages.
72
75
In addition to verifying installations do not break or conflict, pytest is run on the package,
73
76
including all tests found in ` test/ ` directories and [ doctests] .
74
77
78
+ Finally, packages are built and uploaded as artifacts for inspection. When a tag is pushed,
79
+ the packages are uploaded to PyPI if a valid [ API token] ( https://pypi.org/help/#apitoken ) is placed
80
+ in the [ repository secrets] ( https://docs.github.com/en/actions/reference/encrypted-secrets ) .
81
+
75
82
[ doctests ] : https://docs.python.org/3/library/doctest.html
76
83
77
84
# Contributing to this template
You can’t perform that action at this time.
0 commit comments