-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from M3Works/deploy
Code for deploying to pypi
- Loading branch information
Showing
1 changed file
with
38 additions
and
19 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 |
---|---|---|
@@ -1,32 +1,51 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# From: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Upload Python Package | ||
name: Release to Pypi | ||
|
||
# Run on a published release and push to Pypi | ||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
deploy: | ||
build_dist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
|
||
- uses: actions/setup-python@v2 | ||
name: Install Python | ||
with: | ||
python-version: '3.9' | ||
python-version: "3.9" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build package | ||
run: python -m build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
python3 -m pip install --upgrade pip wheel | ||
python3 -m pip install . | ||
- name: Build dist | ||
run: python setup.py sdist --formats=gztar | ||
|
||
- name: Build wheel | ||
run: python3 setup.py bdist_wheel | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_SECRET }} | ||
path: dist/*.tar.gz | ||
|
||
pypi-publish: | ||
needs: [build_dist] | ||
name: upload release to PyPI | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
# retrieve your distributions here | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |