diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..03696c9 --- /dev/null +++ b/.github/workflows/release.yaml @@ -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 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 2590312..65be24f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"}]