Upload to PyPI #15
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
name: Upload to PyPI | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
jobs: | |
build: | |
if: github.repository == 'fdsteffen/fretraj' | |
runs-on: ${{ matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.10','3.11'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get Poetry for Linux/macOS | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
env: | |
POETRY_HOME: ${{ github.workspace }} | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "$POETRY_HOME/bin" >> $GITHUB_PATH | |
- name: Get Poetry for Windows | |
if: matrix.os == 'windows-latest' | |
env: | |
POETRY_HOME: ${{ github.workspace }} | |
run: | | |
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py - | |
echo "$env:POETRY_HOME\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: "fretraj" | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
- name: Build package | |
env: | |
POETRY_VIRTUALENVS_CREATE: false # conda-incubator activates an environment by default | |
run: | | |
poetry build | |
- name: Upload build artefact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: fretraj-dist | |
path: dist | |
retention-days: 1 | |
publish: | |
needs: build | |
if: github.repository == 'fdsteffen/fretraj' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download build artefacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: fretraj-dist | |
path: dist | |
- name: Publish to PyPI | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "$POETRY_HOME/bin" >> $GITHUB_PATH | |
poetry publish | |