Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.github/workflows: add publish workflow #9

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish to PyPI
on:
workflow_dispatch:
inputs:
version:
type: string
description: Version to publish, e.g. "0.1.2"
required: false
push:
tags:
- 'v*.*.*'

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Set version env
id: set_version
## if version is not provided as input, use the tag name
run: |
echo "tag=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
if [ -z "${{ github.event.inputs.version }}" ]; then
echo "tag=${{ github.ref }}" >> $GITHUB_OUTPUT
fi
- name: Set the package version
env:
RELEASE_VERSION: ${{ steps.set_version.outputs.tag }}
run: |
poetry version $RELEASE_VERSION
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}