{"id":19608914,"url":"https://github.com/fire1ce/pypi-publishing-actions","last_synced_at":"2025-07-15T07:33:08.046Z","repository":{"id":182937956,"uuid":"656153713","full_name":"fire1ce/pypi-publishing-actions","owner":"fire1ce","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-24T08:31:00.000Z","size":52,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-31T11:36:11.329Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fire1ce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"fire1ce","patreon":"fire1ce","custom":["https://www.buymeacoffee.com/fire1ce"]}},"created_at":"2023-06-20T11:05:40.000Z","updated_at":"2025-02-24T08:31:08.000Z","dependencies_parsed_at":"2025-05-31T02:29:02.991Z","dependency_job_id":"843369d4-fe9f-45b1-87f1-9bb0953c7ab9","html_url":"https://github.com/fire1ce/pypi-publishing-actions","commit_stats":null,"previous_names":["fire1ce/pypi-test"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/fire1ce/pypi-publishing-actions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fire1ce%2Fpypi-publishing-actions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fire1ce%2Fpypi-publishing-actions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fire1ce%2Fpypi-publishing-actions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fire1ce%2Fpypi-publishing-actions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fire1ce","download_url":"https://codeload.github.com/fire1ce/pypi-publishing-actions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fire1ce%2Fpypi-publishing-actions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262335536,"owners_count":23295673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T10:18:32.832Z","updated_at":"2025-07-15T07:33:08.025Z","avatar_url":"https://github.com/fire1ce.png","language":"Python","funding_links":["https://github.com/sponsors/fire1ce","https://patreon.com/fire1ce","https://www.buymeacoffee.com/fire1ce"],"categories":[],"sub_categories":[],"readme":"# Pypi Publishing Actions Example\n\nThis repository contains GitHub Actions workflows that automate the process of creating GitHub releases and publishing a Python package to PyPI when a new version is specified in the `pyproject.toml` file.\n\n## Repository Structure\n\n```plaintext\n.\n├── .github\n│   ├── workflows\n│   │   ├── create_release_if_new_version.yml\n│   │   └── publish-to-pypi.yml\n│   └\n└\n```\n\n## Workflows\n\n### Create Release if New Version (`create_release_if_new_version.yml`)\n\nThis workflow is responsible for creating a GitHub release when a new version of the Python package is specified in the `pyproject.toml` file. The workflow performs the following steps:\n\n- Gets triggered on pushes to the `main` branch.\n- Checks out the repository code.\n- Sets up Python.\n- Installs necessary Python packages (`toml` and `packaging`) required to read `pyproject.toml` and parse versions.\n- Retrieves the current version from `pyproject.toml`.\n- Fetches all tags to check against the latest tag.\n- Checks if the version is incremented compared to the latest tag.\n- If the version is incremented, it creates a new git tag.\n- Pushes the new git tag to the repository.\n- Creates a new GitHub release with the new tag.\n\n### Publish Python Package to PyPI (`publish-to-pypi.yml`)\n\nThis workflow is responsible for building the Python package and publishing it to PyPI. The workflow performs the following steps:\n\n- Gets triggered by the successful completion of the \"Create Release if New Version\" workflow.\n- Checks out the repository code.\n- Sets up Python.\n- Installs dependencies required to build and publish the package (`build` and `twine`).\n- Builds the Python package.\n- Publishes the package to PyPI or TestPyPI based on the configuration.\n\n## Setup\n\n- Configure the following secrets in your GitHub repository settings under \"Secrets\":\n\n  - `PYPI_API_TOKEN` - Your API token for PyPI (production).\n  - `TEST_PYPI_API_TOKEN` - Your API token for TestPyPI (testing).\n\n- Ensure that your project contains a valid `pyproject.toml` file with the package version specified.\n\n- Push your changes to the `main` branch.\n\n## Usage\n\n- Make changes to your Python package.\n\n- Update the version in `pyproject.toml` according to semantic versioning.\n\n- Push the changes to the `main` branch.\n\n- The \"Create Release if New Version\" workflow will run. If the version is incremented, a GitHub release will be created, and the \"Publish Python Package to PyPI\" workflow will be triggered.\n\n- The \"Publish Python Package to PyPI\" workflow will build and publish your package to the configured PyPI repository (TestPyPI or production PyPI).\n\n## Note\n\n- It is important to increment the version in `pyproject.toml` according to [semantic versioning](https://semver.org/) standards for the workflow to create a release.\n\n- Ensure you have properly configured the `PYPI_API_TOKEN` and `TEST_PYPI_API_TOKEN` secrets in your GitHub repository.\n\n- When Github Repo is Protected, you need to allow `GITHUB_TOKEN` Read and Write access to the repository. Go to the repository Settings \u003e Actions \u003e General \u003e Workflow Permissions \u003e Allow Read and Write permissions.\n\n## Contributing\n\nContributions for improving the workflows are welcome. Please submit a pull request with your changes.\n\n## License\n\nThis project is licensed under the terms of the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffire1ce%2Fpypi-publishing-actions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffire1ce%2Fpypi-publishing-actions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffire1ce%2Fpypi-publishing-actions/lists"}