Skip to content

Commit 01f9859

Browse files
Add workflows to publish to Live and Test PyPI.
1 parent 64213b5 commit 01f9859

File tree

7 files changed

+103
-5
lines changed

7 files changed

+103
-5
lines changed

.github/workflows/python-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Python package
4+
name: Run tests
55

66
on:
77
push:
8-
branches: [ main ]
8+
branches: [ '*' ]
99
pull_request:
1010
branches: [ main ]
1111

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will upload the package to Live Registry of PyPI when a release is created.
2+
# The package will be published here: https://pypi.org/project/codeguru-profiler-agent/
3+
# For more information see: https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python#publishing-to-package-registries
4+
5+
name: Publish to Live PyPI
6+
7+
on:
8+
release:
9+
types: [released]
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: '3.x'
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install setuptools wheel twine
24+
- name: Build and publish
25+
env:
26+
TWINE_USERNAME: '__token__'
27+
TWINE_PASSWORD: ${{ secrets.PYPI_LIVE_PASSWORD }}
28+
run: |
29+
python setup.py sdist bdist_wheel
30+
twine check dist/*
31+
twine upload --verbose dist/*
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This workflow will upload the package to Test Registry of PyPI when a pre-release is created.
2+
# The package will be published here: https://test.pypi.org/project/codeguru-profiler-agent/
3+
# For more information see: https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python#publishing-to-package-registries
4+
5+
name: Publish to Test PyPI
6+
7+
on:
8+
release:
9+
types: [prereleased]
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: '3.x'
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install setuptools wheel twine
24+
- name: Build and publish
25+
env:
26+
TWINE_USERNAME: '__token__'
27+
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }}
28+
TWINE_REPOSITORY_URL: 'https://test.pypi.org/legacy/'
29+
run: |
30+
python setup.py sdist bdist_wheel
31+
twine check dist/*
32+
twine upload --verbose dist/*

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
__pycache__/
22
pytest-report.html
3+
*.egg-info
4+
dist/*

DEVELOPMENT.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
# Release
3+
4+
## How to release to PyPI
5+
6+
#### Create PR with the new agent version
7+
8+
- Create a pull request that updates the agent's version number in the source code [here](https://github.com/aws/amazon-codeguru-profiler-python-agent/blob/main/codeguru_profiler_agent/agent_metadata/agent_metadata.py#L12). You can use directly the editor to edit the file and create the PR.
9+
10+
- Get approval from the [amazon-codeguru-profiler team](https://github.com/orgs/aws/teams/amazon-codeguru-profiler).
11+
12+
- Wait until the [``Run tests`` workflow](https://github.com/aws/amazon-codeguru-profiler-python-agent/actions) passes successfully.
13+
14+
#### Publish package to Test PyPI
15+
16+
- Create a [new pre-release](https://github.com/aws/amazon-codeguru-profiler-python-agent/releases/new) with the agent version and details about what is changed, in the format of a changelog as [in previous releases](https://github.com/aws/amazon-codeguru-profiler-python-agent/releases). Make sure you check the box with "pre-release".
17+
18+
- This will trigger a release to the Test Registry of PyPI, and you can track it in the [Actions tab](https://github.com/aws/amazon-codeguru-profiler-python-agent/actions).
19+
20+
- You can use the agent now from the PyPI **Test** registry as [codeguru-profiler-agent](https://test.pypi.org/project/codeguru-profiler-agent/).
21+
22+
#### Publish package to Live PyPI
23+
24+
- If you want to release to the Live registry of PyPI to be used by customers, go to the [Releases tab]([here](https://test.pypi.org/project/codeguru-profiler-agent/) and edit your pre-releases as prod release.
25+
26+
- This will trigger publishing the package to the Live Registry of PyPI, and you can track it in the [Actions tab](https://github.com/aws/amazon-codeguru-profiler-python-agent/actions).
27+
28+
- You can use the agent now from the PyPI **Live** registry as [codeguru-profiler-agent](https://pypi.org/project/codeguru-profiler-agent/).
29+
30+
## How to release the Lambda Layer.
31+
32+
Check internal instructions.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Check the GitHub repository at [aws/amazon-codeguru-profiler-python-agent](https
1414

1515
See [CONTRIBUTING](CONTRIBUTING.md) for details.
1616

17-
## How to release to PyPI
17+
## How to release
1818

19-
Use the `setup.py` script to create the archive.
19+
See [DEVELOPMENT](DEVELOPMENT.md) for more information.
2020

2121
## Security
2222

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def find_version(*file_paths):
2828
packages=find_packages(exclude="test"),
2929

3030
description="The Python agent to be used for Amazon CodeGuru Profiler",
31-
long_description="https://docs.aws.amazon.com/codeguru/latest/profiler-ug/what-is-codeguru-profiler.html",
31+
long_description=read("README.md"),
32+
long_description_content_type="text/markdown",
3233
author="Amazon Web Services",
3334
url="https://github.com/aws/amazon-codeguru-profiler-python-agent",
3435
download_url="https://github.com/aws/amazon-codeguru-profiler-python-agent",

0 commit comments

Comments
 (0)