1
- # This Release Build workflow is not fully ready yet, will be tested as Beta release when it is ready.
2
1
name : Release Build
3
2
on :
4
3
workflow_dispatch :
5
4
inputs :
6
5
version :
7
- description : The version to tag the release with, e.g., 1.2.0, 1.2.1-alpha.1
6
+ description : The version to tag the release with, e.g., 1.2.0
8
7
required : true
9
8
10
9
env :
11
10
AWS_DEFAULT_REGION : us-east-1
12
- ECR_REGISTRY : 637423224110.dkr.ecr.us-east-1.amazonaws.com
13
- PRIVATE_ECR_REPOSITORY : eks/observability/adot-autoinstrumentation-python
11
+ AWS_PUBLIC_ECR_REGION : us-east-1
12
+ AWS_PRIVATE_ECR_REGION : us-west-2
13
+ RELEASE_PUBLIC_REPOSITORY : public.ecr.aws/aws-observability/adot-autoinstrumentation-python
14
+ RELEASE_PRIVATE_REPOSITORY : 020628701572.dkr.ecr.us-west-2.amazonaws.com/adot-autoinstrumentation-python
15
+ RELEASE_PRIVATE_REGISTRY : 020628701572.dkr.ecr.us-west-2.amazonaws.com
16
+ PACKAGE_NAME : aws-opentelemetry-distro
14
17
15
18
permissions :
16
19
id-token : write
@@ -23,62 +26,98 @@ jobs:
23
26
- name : Checkout Contrib Repo @ SHA - ${{ github.sha }}
24
27
uses : actions/checkout@v4
25
28
29
+ # NOTE: do not set push_image to true for this step.
30
+ # Some of the required params below are set to dummy values
31
+ # as they are only used in the artifacts_build action when push_image is true,
32
+ # and setting them to some legit value might cause confusion
33
+ # to readers.
26
34
- name : Build Wheel and Image Files
27
35
uses : ./.github/actions/artifacts_build
28
36
with :
29
37
aws-region : ${{ env.AWS_DEFAULT_REGION }}
30
- image_uri_with_tag : ${{ env.ECR_REGISTRY }}/${{ env.PRIVATE_ECR_REPOSITORY }}:v${{ github.event.inputs.version }}
31
- image_registry : ${{ env.ECR_REGISTRY }}
32
- snapshot-ecr-role : ${{ secrets.AWS_ASSUME_ROLE_ARN }}
38
+ image_uri_with_tag : " adot-autoinstrumentation-python:test "
39
+ image_registry : " dummy-registry "
40
+ snapshot-ecr-role : " dummy-role "
33
41
push_image : false
34
42
load_image : false
35
43
python_version : " 3.10"
36
44
package_name : aws-opentelemetry-distro
37
45
os : ubuntu-latest
38
46
39
- - name : Get PyPI secrets by name and ARN
47
+ # TODO: Add some sort of smoke/integration testing before we go
48
+ # release the artifacts. adot java for reference:
49
+ # https://github.com/aws-observability/aws-otel-java-instrumentation/tree/93870a550ac30988fbdd5d3bf1e8f9f1b37916f5/smoke-tests
50
+
51
+ - name : Configure AWS credentials for PyPI secrets
52
+ uses : aws-actions/configure-aws-credentials@v4
53
+ with :
54
+ role-to-assume : ${{ secrets.AWS_ROLE_ARN_PYPI_RELEASE }}
55
+ aws-region : ${{ env.AWS_DEFAULT_REGION }}
56
+
57
+ - name : Get PyPI secrets
40
58
uses : aws-actions/aws-secretsmanager-get-secrets@v1
41
59
id : pypi_secrets
42
60
with :
43
61
secret-ids : |
44
- PROD_PYPI_TOKEN,arn:aws:secretsmanager:us-east-1:637423224110:secret:prod/PyPI/apiToken-W2a9ny
45
- TEST_PYPI_TOKEN,arn:aws:secretsmanager:us-east-1:637423224110:secret:test/PyPI/apiToken-z5iqc6
62
+ PROD_PYPI_TOKEN,${{ secrets.PYPI_PROD_TOKEN_SECRET_ARN }}
63
+ TEST_PYPI_TOKEN,${{ secrets.PYPI_TEST_TOKEN_SECRET_ARN }}
64
+ parse-json-secrets : true
46
65
47
- - name : Export distro version
48
- id : distro_version
49
- shell : bash
50
- run : |
51
- pkg_version=$(grep '__version__' ./aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py | awk -F '"' '{print $2}')
52
- echo "ADOT_PYTHON_VERSION=$pkg_version" >> $GITHUB_OUTPUT
66
+ - name : Configure AWS credentials for private ECR
67
+ uses : aws-actions/configure-aws-credentials@v4
68
+ with :
69
+ role-to-assume : ${{ secrets.AWS_ROLE_ARN_ECR_RELEASE }}
70
+ aws-region : ${{ env.AWS_PRIVATE_ECR_REGION }}
71
+
72
+ - name : Log in to AWS private ECR
73
+ uses : docker/login-action@v3
74
+ with :
75
+ registry : ${{ env.RELEASE_PRIVATE_REGISTRY }}
76
+
77
+ - name : Configure AWS credentials for public ECR
78
+ uses : aws-actions/configure-aws-credentials@v4
79
+ with :
80
+ role-to-assume : ${{ secrets.AWS_ROLE_ARN_ECR_RELEASE }}
81
+ aws-region : ${{ env.AWS_PUBLIC_ECR_REGION }}
82
+
83
+ - name : Log in to AWS public ECR
84
+ uses : docker/login-action@v3
85
+ with :
86
+ registry : public.ecr.aws
53
87
54
88
# The step below publishes to testpypi in order to catch any issues
55
89
# with the package configuration that would cause a failure to upload to pypi.
90
+ - name : Install twine
91
+ run : pip install twine
92
+
56
93
- name : Publish to TestPyPI
57
94
env :
58
95
TWINE_USERNAME : ' __token__'
59
- TWINE_PASSWORD : ${{ steps.pypi_secrets.outputs.TEST_PYPI_TOKEN }}
96
+ TWINE_PASSWORD : ${{ env.TEST_PYPI_TOKEN_API_TOKEN }}
60
97
run : |
61
- pip install --upgrade twine
62
- twine upload --repository testpypi --skip-existing --verbose dist/aws_opentelemetry_distro-${{ steps.distro_version.outputs.ADOT_PYTHON_VERSION }}-py3-none-any.whl
98
+ twine upload --repository testpypi --skip-existing --verbose dist/aws_opentelemetry_distro-${{ github.event.inputs.version }}-py3-none-any.whl
63
99
64
- - name : Push release image
100
+ # The following step publish to ECR
101
+ - name : Build and push images
65
102
uses : docker/build-push-action@v5
66
103
with :
67
104
push : true
68
105
context : .
69
106
file : ./Dockerfile
70
107
platforms : linux/amd64,linux/arm64
71
- tags : ${{ env.ECR_REGISTRY }}/${{ env.PRIVATE_ECR_REPOSITORY }}:v${{ github.event.inputs.version }}
108
+ tags : |
109
+ ${{ env.RELEASE_PRIVATE_REPOSITORY }}:v${{ github.event.inputs.version }}
110
+ ${{ env.RELEASE_PUBLIC_REPOSITORY }}:v${{ github.event.inputs.version }}
72
111
73
- # TODO: Uncomment "Publish to PyPI" after test release_build workflow.
74
- # - name: Publish to PyPI
75
- # env:
76
- # TWINE_USERNAME: '__token__'
77
- # TWINE_PASSWORD: ${{ steps.pypi_secrets.outputs.PROD_PYPI_TOKEN }}
78
- # run: |
79
- # twine upload --skip-existing --verbose dist/aws_opentelemetry_distro-${{ steps.distro_version.outputs.ADOT_PYTHON_VERSION }}-py3-none-any.whl
112
+ # Publish to prod PyPI
113
+ - name : Publish to PyPI
114
+ env :
115
+ TWINE_USERNAME : ' __token__'
116
+ TWINE_PASSWORD : ${{ env.PROD_PYPI_TOKEN_API_TOKEN }}
117
+ run : |
118
+ twine upload --skip-existing --verbose dist/aws_opentelemetry_distro-${{ github.event.inputs.version }}-py3-none-any.whl
80
119
81
- - name : Create release
120
+ - name : Create GH release
82
121
id : create_release
83
122
env :
84
123
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
87
126
--title "Release v${{ github.event.inputs.version }}" \
88
127
--draft \
89
128
"v${{ github.event.inputs.version }}" \
90
- dist/aws_opentelemetry_distro-${{ steps.distro_version.outputs.ADOT_PYTHON_VERSION }}-py3-none-any.whl
129
+ dist/aws_opentelemetry_distro-${{ github.event.inputs.version }}-py3-none-any.whl
0 commit comments