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
24 changes: 24 additions & 0 deletions .buildkite/pipeline.release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
agents:
queue: hosted

steps:
# This is most to prevent we accidentally tag things.
- block: "OK to release?"

- command: ".buildkite/steps/release-pypi"
label: ":pypi:"
if: build.tag != null
env:
# > The username to authenticate to the repository (package index) as. Has no effect on PyPI
# It should be a noop, I set it anyway to prevent prompt showing up.
TWINE_USERNAME: __token__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this referring to. Can you explain this bit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this input is a noop for PyPi. According to: twine upload --help

The username to authenticate to the repository (package index) as. Has no effect on PyPI or TestPyPI. (Can
also be set via TWINE_USERNAME environment variable.)

But I set it anyway to prevent prompt showing up.

I guess I could also use --non-interactive, but it would break UX when we use the script manually. 🤷🏿 so I am not sure which one is better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha! Maybe worth putting that quote in the code as comment?

plugins:
- cluster-secrets#v1.0.0:
variables:
TWINE_PASSWORD: test-collector-python-pypi-api-token
Comment on lines +15 to +18
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pipeline isn't working yet as I am still pending on some plumbing works to get this secret provisioned.

But merging this PR has no harm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will use a follow-up PR to replace this with AWS SSM

- docker#v5.12.0:
image: "python:3.13"
environment:
- TWINE_USERNAME
- TWINE_PASSWORD

21 changes: 21 additions & 0 deletions .buildkite/steps/release-pypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -o errexit
set -o pipefail
set -o nounset

__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root="$(cd "$(dirname "${__dir}")"/../ && pwd)"

cd "$__root"

python -m venv .venv && source .venv/bin/activate

pip install -e '.[dev]'

# It will spit out a tar.gz in ./dist
python -m build

python -m twine check dist/*

python -m twine upload --skip-existing dist/*
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,12 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/buildk

## 🚀 Releasing

1. Version bump the code, tag and push.
2. Publish to the [Python Package Index](https://pypi.org/):

```sh
python3 -m build
python3 -m twine upload dist/*
```

3. Create a [new github release](https://github.com/buildkite/test-collector-python/releases).
1. Open a new PR bumping the version number in `constants.py`.
2. Get the PR approved and merged.
3. Tag the merge commit with the same version number, then git push.
4. Go to release pipeline and approve the pipeline to execute.
5. (Optional) In the event of step 4 failure, run `.buildkite/steps/release-pypi` locally with your own credentials.
6. Create a [new github release](https://github.com/buildkite/test-collector-python/releases).

## 📜 License

Expand Down