Skip to content

Commit

Permalink
Merge pull request #2 from M3Works/deploy
Browse files Browse the repository at this point in the history
Code for deploying to pypi
  • Loading branch information
micah-prime authored Oct 16, 2023
2 parents 195d333 + aa2a517 commit 7000b10
Showing 1 changed file with 38 additions and 19 deletions.
57 changes: 38 additions & 19 deletions .github/workflows/release_pypi.yaml
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

0 comments on commit 7000b10

Please sign in to comment.