Update publish_package.yml #2
Workflow file for this run
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
# This workflows 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 | |
on: | |
push: | |
tags: | |
- '**' | |
env: | |
POETRY_VERSION: 1.4.0 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
# Run on a push to a tag or master | |
if: > | |
github.event_name == 'push' && | |
(startsWith(github.event.ref, 'refs/tags') || | |
github.event.ref == 'refs/heads/master') | |
steps: | |
- name: Set up Python 3 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
- name: Install latest setuptools, wheel, pip | |
run: python3 -m pip install -U pip setuptools wheel | |
- name: Cache Installations | |
id: cache-installs | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local | |
key: install-${{ env.INSTALL_CACHE_HASH }}-3 | |
- name: Install Poetry | |
if: steps.cache-installs.outputs.cache-hit != 'true' | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - --version ${{ env.POETRY_VERSION }} | |
- name: Test poetry | |
run: poetry --version | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Install rfinder | |
run: poetry install | |
- name: Build distribution | |
run: poetry build | |
- name: Publish distribution 📦 to Test PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
continue-on-error: true | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |