Skip to content

Commit 3db8be3

Browse files
srprashthpierce
andauthored
Upload source distribution to pypi (#532)
*Issue:* Generally a good practice to upload sdist along with the wheel artifact to PyPI: https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#source-distributions OTel SDK package for reference: https://pypi.org/project/opentelemetry-sdk/#files *Description of changes:* We are already building the source distribution tarball. This PR updates the release workflow to just upload it. *Testing:* Tested a successful upload to test pypi in this modified release workflow run (verified by @thpierce): https://github.com/aws-observability/aws-otel-python-instrumentation/actions/runs/19081104321 By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. --------- Co-authored-by: Thomas Pierce <[email protected]>
1 parent a9d39f8 commit 3db8be3

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

.github/workflows/release-build.yml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ env:
1818
RELEASE_PRIVATE_REPOSITORY: 020628701572.dkr.ecr.us-west-2.amazonaws.com/adot-autoinstrumentation-python
1919
RELEASE_PRIVATE_REGISTRY: 020628701572.dkr.ecr.us-west-2.amazonaws.com
2020
PACKAGE_NAME: aws-opentelemetry-distro
21-
ARTIFACT_NAME: aws_opentelemetry_distro-${{ github.event.inputs.version }}-py3-none-any.whl
21+
WHEEL_ARTIFACT_NAME: aws_opentelemetry_distro-${{ github.event.inputs.version }}-py3-none-any.whl
22+
SOURCE_ARTIFACT_NAME: aws_opentelemetry_distro-${{ github.event.inputs.version }}.tar.gz
2223
# Legacy list of commercial regions to deploy to. New regions should NOT be added here, and instead should be added to the `aws_region` default input to the workflow.
2324
LEGACY_COMMERCIAL_REGIONS: us-east-1, us-east-2, us-west-1, us-west-2, ap-south-1, ap-northeast-3, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-northeast-1, ca-central-1, eu-central-1, eu-west-1, eu-west-2, eu-west-3, eu-north-1, sa-east-1
2425
LAYER_NAME: AWSOpenTelemetryDistroPython
@@ -67,11 +68,17 @@ jobs:
6768
# release the artifacts. adot java for reference:
6869
# https://github.com/aws-observability/aws-otel-java-instrumentation/tree/93870a550ac30988fbdd5d3bf1e8f9f1b37916f5/smoke-tests
6970

70-
- name: Upload SDK artifact
71+
- name: Upload SDK wheel artifact
7172
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
7273
with:
73-
name: ${{ env.ARTIFACT_NAME }}
74-
path: dist/${{ env.ARTIFACT_NAME }}
74+
name: ${{ env.WHEEL_ARTIFACT_NAME }}
75+
path: dist/${{ env.WHEEL_ARTIFACT_NAME }}
76+
77+
- name: Upload SDK source artifact
78+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
79+
with:
80+
name: ${{ env.SOURCE_ARTIFACT_NAME }}
81+
path: dist/${{ env.SOURCE_ARTIFACT_NAME }}
7582

7683
build-layer:
7784
needs: build-sdk
@@ -162,25 +169,30 @@ jobs:
162169
- name: Install twine
163170
run: pip install twine==5.1.1
164171

165-
- name: Download SDK artifact
172+
- name: Download SDK wheel artifact
173+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 #v5.0.0
174+
with:
175+
name: ${{ env.WHEEL_ARTIFACT_NAME }}
176+
177+
- name: Download SDK source artifact
166178
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 #v5.0.0
167179
with:
168-
name: ${{ env.ARTIFACT_NAME }}
180+
name: ${{ env.SOURCE_ARTIFACT_NAME }}
169181

170182
- name: Publish to TestPyPI
171183
env:
172184
TWINE_USERNAME: '__token__'
173185
TWINE_PASSWORD: ${{ env.TEST_PYPI_TOKEN_API_TOKEN }}
174186
run: |
175-
twine upload --repository testpypi --skip-existing --verbose ${{ env.ARTIFACT_NAME }}
187+
twine upload --repository testpypi --skip-existing --verbose ${{ env.WHEEL_ARTIFACT_NAME }} ${{ env.SOURCE_ARTIFACT_NAME }}
176188
177189
# Publish to prod PyPI
178190
- name: Publish to PyPI
179191
env:
180192
TWINE_USERNAME: '__token__'
181193
TWINE_PASSWORD: ${{ env.PROD_PYPI_TOKEN_API_TOKEN }}
182194
run: |
183-
twine upload --skip-existing --verbose ${{ env.ARTIFACT_NAME }}
195+
twine upload --skip-existing --verbose ${{ env.WHEEL_ARTIFACT_NAME }} ${{ env.SOURCE_ARTIFACT_NAME }}
184196
185197
# Publish to public ECR
186198
- name: Build and push public ECR image
@@ -361,10 +373,10 @@ jobs:
361373
- name: Checkout Repo @ SHA - ${{ github.sha }}
362374
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
363375

364-
- name: Download SDK artifact
376+
- name: Download SDK wheel artifact
365377
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 #v5.0.0
366378
with:
367-
name: ${{ env.ARTIFACT_NAME }}
379+
name: ${{ env.WHEEL_ARTIFACT_NAME }}
368380

369381
- name: Download layer.zip artifact
370382
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 #v5.0.0
@@ -439,15 +451,15 @@ jobs:
439451
${{ needs.generate-lambda-release-note.outputs.layer-note }}
440452
EOF
441453
442-
shasum -a 256 ${{ env.ARTIFACT_NAME }} > ${{ env.ARTIFACT_NAME }}.sha256
454+
shasum -a 256 ${{ env.WHEEL_ARTIFACT_NAME }} > ${{ env.WHEEL_ARTIFACT_NAME }}.sha256
443455
shasum -a 256 layer.zip > layer.zip.sha256
444456
445457
gh release create --target "$GITHUB_REF_NAME" \
446458
--title "Release v$VERSION" \
447459
--notes-file release_notes.md \
448460
--draft \
449461
"v$VERSION" \
450-
${{ env.ARTIFACT_NAME }} \
451-
${{ env.ARTIFACT_NAME }}.sha256 \
462+
${{ env.WHEEL_ARTIFACT_NAME }} \
463+
${{ env.WHEEL_ARTIFACT_NAME }}.sha256 \
452464
layer.zip \
453-
layer.zip.sha256
465+
layer.zip.sha256

0 commit comments

Comments
 (0)