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
126 changes: 126 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Release to PyPI

# Testing with corrected TestPyPI trusted publisher config

on:
push:
tags:
- 'v*'
branches:
- 'test-release-*'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.7.17"

- name: Install dependencies
run: |
uv sync --group dev

- name: Run tests
run: |
uv run pytest tests/ --cov=src --cov-report=term-missing -v

- name: Run linting
run: |
uv run pre-commit run --all-files

- name: Build package
run: |
uv build

- name: Check build
run: |
uv run twine check dist/*

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
if: startsWith(github.ref_name, 'test-release-')
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/munge
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Debug environment and files
run: |
echo "=== Environment Debug ==="
echo "GITHUB_REF: $GITHUB_REF"
echo "GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "GITHUB_REPOSITORY: $GITHUB_REPOSITORY"
echo "GITHUB_WORKFLOW: $GITHUB_WORKFLOW"
echo ""
echo "=== Distribution Files ==="
ls -la dist/
echo "Number of files: $(ls -1 dist/ | wc -l)"
echo ""
echo "=== File Contents Check ==="
for file in dist/*; do
echo "File: $file"
echo "Size: $(stat -c%s "$file") bytes"
done

- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

- name: TestPyPI publishing status
run: |
echo "TestPyPI publishing attempted."
echo "If it failed, you need to configure trusted publishing at:"
echo "https://test.pypi.org/manage/account/publishing/"
echo ""
echo "Configuration needed:"
echo "- Repository: 20c/munge"
echo "- Workflow filename: release.yaml"
echo "- Environment name: (leave empty for now)"

publish-to-pypi:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/munge
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "munge"
version = "1.3.0"
version = "1.3.1.dev1"
description = "data manipulation library and client"
readme = "README.md"
authors = [{name = "20C", email = "code@20c.com"}]
Expand Down
Loading