Skip to content

Commit 8632951

Browse files
authored
feat: Add Publish to PyPI Steps to UDP Exporter Release Workflow (#339)
**Description of changes:** Setting up PyPI publishing steps in our UDP Exporter release workflow. The changes are largely the same our [workflow steps](https://github.com/aws-observability/aws-otel-python-instrumentation/blob/main/.github/workflows/release_build.yml#L82) used to publish our ADOT package to PyPI. **Test Plan:** Test workflow run via feature branch: - [Successful workflow run](https://github.com/aws-observability/aws-otel-python-instrumentation/actions/runs/13799176618/job/38597855879) - [Artifact successfully published to Test PyPI](https://test.pypi.org/project/aws-otel-otlp-udp-exporter/0.0.1/) By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 79049d8 commit 8632951

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

.github/workflows/release-udp-exporter.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ on:
77
description: 'Version number for deployment e.g. 0.1.0'
88
required: true
99
type: string
10+
env:
11+
AWS_DEFAULT_REGION: us-east-1
12+
ARTIFACT_NAME: aws_otel_otlp_udp_exporter-${{ github.event.inputs.version }}-py3-none-any.whl
13+
14+
permissions:
15+
id-token: write
16+
contents: write
1017

1118
jobs:
1219
build-test-publish:
@@ -74,4 +81,37 @@ jobs:
7481
exit 1
7582
fi
7683
77-
# TODO: Steps to publish to PyPI
84+
- name: Configure AWS credentials for PyPI secrets
85+
uses: aws-actions/configure-aws-credentials@v4
86+
with:
87+
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRETS_MANAGER }}
88+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
89+
90+
- name: Get PyPI secrets
91+
uses: aws-actions/aws-secretsmanager-get-secrets@v1
92+
id: pypi_secrets
93+
with:
94+
secret-ids: |
95+
PROD_PYPI_TOKEN,${{ secrets.PYPI_PROD_TOKEN_SECRET_ARN }}
96+
TEST_PYPI_TOKEN,${{ secrets.PYPI_TEST_TOKEN_SECRET_ARN }}
97+
parse-json-secrets: true
98+
99+
- name: Install twine
100+
run: pip install twine
101+
102+
# The step below publishes to testpypi in order to catch any issues
103+
# with the package configuration that would cause a failure to upload to PyPI.
104+
- name: Publish to TestPyPI
105+
env:
106+
TWINE_USERNAME: '__token__'
107+
TWINE_PASSWORD: ${{ env.TEST_PYPI_TOKEN_API_TOKEN }}
108+
run: |
109+
twine upload --repository testpypi --skip-existing --verbose exporters/aws-otel-otlp-udp-exporter/dist/${{ env.ARTIFACT_NAME }}
110+
111+
# Publish to prod PyPI
112+
- name: Publish to PyPI
113+
env:
114+
TWINE_USERNAME: '__token__'
115+
TWINE_PASSWORD: ${{ env.PROD_PYPI_TOKEN_API_TOKEN }}
116+
run: |
117+
twine upload --skip-existing --verbose exporters/aws-otel-otlp-udp-exporter/dist/${{ env.ARTIFACT_NAME }}

0 commit comments

Comments
 (0)