---
# System prepended metadata

title: Ansible Community package release on PyPI
tags: [Release]

---

## Disclaimer 

This is a live document. Please feel free to comment and share your views.

## Introduction 

The Release Managers for Ansible Community Package, are always the Ansible Community Team members, who are Red Hatters. But with this endeavor we are trying to open up the release process to the community members. So an interested and designated group of people can be Release Ansible.
Who can be the release managers for Ansible Community Package?

Anyone from the Ansible Community can be the RM for Ansible Community Package. We will be forming a Release Manager Working Group from the community who will be not only doing the release but also taking the decisions and responsible for work in and around the release process (barring certain reasonable restrictions and limitations). 

## Shadow release managers

Mentorship and building trust is at the very core of this process. Any community member (mentee) who wants to be the release manager needs to be the shadow for the release process for a period of 3 months and/or for 6 separate releases (whichever is appropriate, can be decided on a case to case basis). It is necessary/advisable the mentees to be the shadow release managers for the following :

- First Alpha release
- one Pre-Release (other than)
- one GA release
- One stable release

The mentor (the release manager) after the discussion with the community and the mentee will decide if the mentee is ready to be the release manager. 

## Automation of the current release process

We are trying to automate the current release process with Github Actions (GHA). We wrote the initial workflow(s). This workflow tries to follow the current release process as much as possible. 

#### Step 1 


Run the [ansible-release workflow] to create the release PR to the ansible-build-data repo.

[ansible-release workflow]:
https://github.com/anweshadas/ansible-build-data/blob/test/.github/workflows/ansible-release.yml

#### Step 2

After the PR is merged by a maintainer, run [upload-to-pypi] to upload the [distribution packages] to PyPI.


[upload-to-pypi]:
https://github.com/anweshadas/ansible-build-data/blob/test/.github/workflows/upload-to-pypi.yml

#### Step 3

After uploading the source to PyPI run [docsbuild-release workflow] to  create PR to ansible-documentation.

[docsbuild-release workflow]:
https://github.com/anweshadas/ansible-documentation/blob/test/.github/workflows/docsbuild-release.yaml

### Plan for betterment this workflow 

Here is the plan to improve the intial workflow

The process needs to be divided in two parts: Pre-Release and Release

Pre- Release includes:

- Creating PR in ansible-build-data
- Merging (manually) the above mentioned PR

Pre-requisite : A new ansible-core release will trigger the Pre-Release workflow

Release workflow includes:

- Make and upload GHA artifact
- Creating PR in ansible-documentation
- Releasing the tar in test.pypi.org
- Releasing the tar to PyPI
- Creating the Git Tag
- Releasing the [distribution packages] to PyPI

Pre-requisite : The release workflow will run (manually) only after the merging of ansible-build-data PR.

[distribution packages]:
https://packaging.python.org/en/latest/glossary/#term-Distribution-Package

The new upstream recommendations for building and publishing from github action to (Test)PyPI:
https://github.com/pypa/packaging.python.org/pull/1261

### Todo 

#### Minimal Viable Product

- [ ] Include creating the release tag in the process — should be done post pypi-publish so depends on having a separate pypi publish job (not testpypi)
- [ ] Building the wheels — this is already happening in [upload-to-pypi] but the [antsibull CLI option name is misleading]
- [ ] Test of the release — how? If there's an existing CI worklow, it can be made reusable and injected into the process
- [ ] Change in Workflow settings in the concerned repos.
  - https://toshio.fedorapeople.org/ansible/action-permissions.png
- [ ] Make the work done in the anweshadas test branches into PRs and get them merged to ansible-community/ansible-build-data and ansible/ansible-documentation
  - [ ] PR for ansible-documentation
  - [ ] PR for the pre-release workflow for ansible-build-data
  - [ ] PR for the release workflow for ansible-build-data

[antsibull CLI option name is misleading]: https://github.com/ansible-community/antsibull/issues/539

#### Future Enhancments

- [ ] How to deal with the release announcement?
- [ ] Using of Sigstore to sign tarball and wheel — this is a matter of copy-pasting 2 workflow steps
- [ ] Merge the release workflow and the docs workflow
- [ ] Separate jobs for building from deps file, signing, publishing to pypi
- [ ] Make and upload GHA artifact.
- [ ] Two seperate jobs for TestPyPI and PyPI

