-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change pypi_publish.yml to publish_sdist_to_pypi.yml (#895)
- Add if-else branching according to tag name for publishing to PyPI or TestPyPI - Fix to publish source distribution only - Upload source distribution to Github Release page too Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
- Loading branch information
Showing
2 changed files
with
57 additions
and
41 deletions.
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,57 @@ | ||
name: Publish Source Distribution to PyPI | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish-sdist-to-pypi: | ||
environment: pypi | ||
name: Publish Source Distribution to PyPI | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.9" | ||
- name: Install pypa/build | ||
run: >- | ||
python -m | ||
pip install | ||
build | ||
--user | ||
- name: Build a source tarball | ||
run: >- | ||
python -m | ||
build | ||
--sdist | ||
--outdir dist/ | ||
. | ||
- name: Upload package distributions to github | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: dist/* | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
file_glob: true | ||
- name: Check tag to determine where to publish the source distribution to PyPI or TestPyPI | ||
id: check-tag | ||
uses: actions-ecosystem/action-regex-match@v2 | ||
with: | ||
text: ${{ github.ref }} | ||
regex: '^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$' | ||
- name: Publish package distributions to PyPI | ||
if: ${{ steps.check-tag.outputs.match != '' }} | ||
uses: pypa/gh-action-pypi-publish@v1.7.1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
- name: Publish package distributions to TestPyPI | ||
if: ${{ steps.check-tag.outputs.match == '' }} | ||
uses: pypa/gh-action-pypi-publish@v1.7.1 | ||
with: | ||
password: ${{ secrets.TESTPYPI_API_TOKEN }} | ||
repository-url: https://test.pypi.org/legacy/ |
This file was deleted.
Oops, something went wrong.