This repository has been archived by the owner on Nov 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add workflow to publish to PyPI (not used yet)
- Loading branch information
1 parent
ad876b4
commit fe17dc4
Showing
1 changed file
with
48 additions
and
0 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,48 @@ | ||
# This workflow will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
|
||
name: Upload Python Package to PyPi | ||
|
||
on: | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python Package to PyPI | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: get latest release with tag | ||
id: latestrelease | ||
run: | | ||
echo "::set-output name=releasetag::$(curl -s https://api.github.com/repos/dylanljones/cmpy/releases/latest --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq '.tag_name' | sed 's/\"//g')" | ||
- name: confirm release tag | ||
run: | | ||
echo ${{ steps.latestrelease.outputs.releasetag }} | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ steps.latestrelease.outputs.releasetag }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install twine | ||
pip install .[build] | ||
- name: Build and publish distribution 📦 to PyPI | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload --repository testpypi dist/* |