Skip to content

Fix publish workflow artifact build and separate TestPyPI publishing - #133

Merged
markobud merged 5 commits into
masterfrom
copilot/fix-issue-with-publish-action
Feb 9, 2026
Merged

Fix publish workflow artifact build and separate TestPyPI publishing#133
markobud merged 5 commits into
masterfrom
copilot/fix-issue-with-publish-action

Conversation

Copilot AI commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

The publish workflow failed with "Artifact not found for name: sdist" because build_artifacts job only printed placeholders instead of building artifacts. Additionally, TestPyPI and PyPI publishing were coupled in a single workflow.

Changes

Fixed artifact building

  • build_artifacts now installs GLPK and build dependencies
  • Executes python -m build --sdist and uploads artifact
  • Handles optional wheel artifacts gracefully with continue-on-error

Separated publishing workflows with optimized triggers

  • test_publish.yml: TestPyPI publishing
    • Automatic trigger on release publication (primary workflow)
    • Manual trigger with "test-publish" confirmation (optional)
  • publish_pypi.yml: Production PyPI publishing (renamed from publish.yml)
    • Manual trigger only with "publish" confirmation
    • Run after verifying TestPyPI package works
    • Removed TestPyPI step (now separate workflow)

Shell script fixes

  • Changed [ ! -f dist/*.tar.gz ] to ! ls dist/*.tar.gz >/dev/null 2>&1
  • Fixed glob pattern expansion in artifact verification

Documentation

  • .github/PUBLISHING_WORKFLOWS.md: Trusted publishing setup, workflow usage, troubleshooting
  • Updated with recommended release process

Workflow structure

# TestPyPI (automatic on release)
verify_test → build_artifacts → publish_testpypi → verify_testpypi
                              
                        (uploads sdist artifact)

# PyPI (manual only)
verify_release → build_artifacts → download_artifacts → publish_pypi → verify_publication
                                 
                           (uploads sdist artifact)

Recommended Release Process

  1. Create a GitHub release → test_publish.yml runs automatically and publishes to TestPyPI
  2. Verify the package works on TestPyPI
  3. Manually trigger publish_pypi.yml for production PyPI publishing

Both workflows build sdist independently. Wheels from build-wheels.yml are optional and merged if available.

Original prompt

This section details on the original issue you should resolve

<issue_title>CD/CI publish error</issue_title>
<issue_description>Github action .github/workflows/publish.yml failed. Here below the copilot analysis of the error. Besides, it is preferable that the current action points to TestPyPi rather than directly to PyPi. So, rename it after fixing and do changes to test_publish.yml

The job failed because the artifact named sdist could not be found or downloaded. The error message is:

Unable to download artifact(s): Artifact not found for name: sdist

Solution:
Ensure that the source distribution (sdist) is built and uploaded in a prior workflow or job before the step in publish.yml that downloads it. Currently, the build_artifacts job does not build or upload artifacts; it only prints placeholder messages.

To fix this, add a build and upload step for sdist in build_artifacts. For example:

  • name: Build sdist
    run: python -m build --sdist

  • name: Upload sdist
    uses: actions/upload-artifact@v4
    with:
    name: sdist
    path: dist/*.tar.gz

Make sure these steps run before download_artifacts. This will ensure the sdist artifact is available when needed, resolving the failure.</issue_description>

<agent_instructions>Use any log information you can find</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Custom agent used: CI/CD Expert
An agent expert in CI/CD for Python/Cython cross-platform builds


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 9, 2026 04:08
- Fix build_artifacts job to actually build and upload sdist
- Add system dependencies (GLPK) to build process
- Create test_publish.yml for TestPyPI testing
- Rename publish.yml to publish_pypi.yml for production
- Remove TestPyPI step from production workflow

Co-authored-by: markobud <93592045+markobud@users.noreply.github.com>
- Create comprehensive documentation for publishing workflows
- Explain TestPyPI and PyPI publishing processes
- Add setup instructions for trusted publishing
- Include troubleshooting guide

Co-authored-by: markobud <93592045+markobud@users.noreply.github.com>
- Use proper command substitution for glob pattern checks
- Fix tar.gz existence check to use ls with exit code
- Fix wheel existence check to use ls with exit code

Co-authored-by: markobud <93592045+markobud@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CD/CI publish error in GitHub actions Fix publish workflow artifact build and separate TestPyPI publishing Feb 9, 2026
Copilot AI requested a review from markobud February 9, 2026 04:13
@markobud

markobud commented Feb 9, 2026

Copy link
Copy Markdown
Owner

@copilot This is excellent, but I'd swap the triggers of test_publish and publish_pypi. Let's test_publish be triggered by tagging a new release and publish_pypi be triggered manually

- test_publish.yml now triggers automatically on release (+ manual)
- publish_pypi.yml is now manual-only (after TestPyPI testing)
- Update verification logic to handle both trigger types
- Update documentation to reflect new workflow process

Co-authored-by: markobud <93592045+markobud@users.noreply.github.com>

Copilot AI commented Feb 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot This is excellent, but I'd swap the triggers of test_publish and publish_pypi. Let's test_publish be triggered by tagging a new release and publish_pypi be triggered manually

Done in commit 59f313b. The triggers have been swapped:

  • test_publish.yml now triggers automatically on release publication (and can also be triggered manually)
  • publish_pypi.yml is now manual-only with "publish" confirmation

The recommended workflow is now:

  1. Create a release → TestPyPI publishes automatically
  2. Verify the package on TestPyPI
  3. Manually trigger PyPI publishing after confirmation

Documentation has been updated accordingly.

@markobud
markobud marked this pull request as ready for review February 9, 2026 04:21
@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

  • .github/workflows/publish.yml

@markobud
markobud merged commit 2040aab into master Feb 9, 2026
22 checks passed
@markobud
markobud deleted the copilot/fix-issue-with-publish-action branch February 9, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CD/CI publish error

2 participants