Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Commit

Permalink
ci: add workflow to publish to PyPI (not used yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanljones committed Mar 16, 2022
1 parent ad876b4 commit fe17dc4
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/pypi-publish.yml
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/*

0 comments on commit fe17dc4

Please sign in to comment.