Skip to content
Merged
Show file tree
Hide file tree
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
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: publish-pypi

on:
push:
tags:
- 'v*'

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install build tools
run: pip install build twine

- name: Build distribution
run: python -m build

- name: Check distribution
run: python -m twine check dist/*

- name: Upload to PyPI
run: python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
26 changes: 26 additions & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail

DRY_RUN=false

for arg in "$@"; do
case "$arg" in
--dry-run) DRY_RUN=true ;;
*) echo "Unknown argument: $arg" >&2; exit 1 ;;
esac
done

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

echo "Building pocketstation distribution..."
python -m build "$REPO_ROOT"

if [ "$DRY_RUN" = true ]; then
echo "Dry-run: checking distribution with twine..."
python -m twine check "$REPO_ROOT/dist/"*
echo "Dry-run complete. No package was uploaded."
else
echo "Uploading pocketstation to PyPI..."
python -m twine upload "$REPO_ROOT/dist/"*
echo "Uploaded successfully."
fi
Loading