Skip to content
This repository has been archived by the owner on Apr 21, 2024. It is now read-only.

Commit

Permalink
Add action to deploy on PyPI and GitHub Releases
Browse files Browse the repository at this point in the history
  • Loading branch information
teobucci committed Feb 27, 2024
1 parent 7ae1c6d commit f9bfe39
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/release_pypi_github.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish to PyPI and release to GitHub on tag

on:
push:
branches:
- main
tags:
- "*"

jobs:
build-n-publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/[email protected]

- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine bumpver build
- name: Build source and wheel distributions
run: |
python -m build
twine check dist/*
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Create GitHub Release
id: create_release
uses: ncipollo/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
draft: false
prerelease: false

- name: Get Asset name
run: |
export PKG=$(ls dist/ | grep tar)
set -- $PKG
echo "name=$1" >> $GITHUB_ENV
- name: Upload Release Asset (sdist) to GitHub
id: upload-release-asset
uses: tanyagray/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/${{ env.name }}
asset_name: ${{ env.name }}
asset_content_type: application/zip

0 comments on commit f9bfe39

Please sign in to comment.