-
Notifications
You must be signed in to change notification settings - Fork 15
91 lines (83 loc) · 3.46 KB
/
release_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Release Build
on:
# workflow_dispatch:
# inputs:
# version:
# description: The version to tag the release with, e.g., 1.2.0, 1.2.1-alpha.1
# required: true
push:
branches:
- main_workflow
pull_request:
branches:
- main
- "release/v*"
env:
AWS_DEFAULT_REGION: us-east-1
ECR_REGISTRY: 637423224110.dkr.ecr.us-east-1.amazonaws.com
PRIVATE_ECR_REPOSITORY: eks/observability/adot-autoinstrumentation-python
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Build Wheel and Image Files
uses: ./.github/actions/artifacts_build
with:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
image_uri_with_tag: ${{ env.ECR_REGISTRY }}/${{ env.PRIVATE_ECR_REPOSITORY }}:v_test
image_registry: ${{ env.ECR_REGISTRY }}
snapshot-ecr-role: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
push_image: false
load_image: false
python_version: 3.11
package_name: aws-opentelemetry-distro
os: ubuntu-latest
- name: Get PyPI secrets by name and ARN
uses: aws-actions/aws-secretsmanager-get-secrets@v1
id: pypi_secrets
with:
secret-ids: |
PROD_PYPI_TOKEN,arn:aws:secretsmanager:us-east-1:637423224110:secret:prod/PyPI/apiToken-W2a9ny
TEST_PYPI_TOKEN,arn:aws:secretsmanager:us-east-1:637423224110:secret:test/PyPI/apiToken-z5iqc6
- name: Push Release image
uses: docker/build-push-action@v5
with:
push: true
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ env.ECR_REGISTRY }}/${{ env.PRIVATE_ECR_REPOSITORY }}:v_test
- name: Create release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
run: |
pwd
pkg_version=$(grep '__version__' ./aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py | awk -F '"' '{print $2}')
echo "ADOT_PYTHON_VERSION=$pkg_version" >> $GITHUB_OUTPUT
gh release create --target "$GITHUB_REF_NAME" \
--title "Release v${{ github.event.inputs.version }}" \
--draft \
"v${{ github.event.inputs.version }}" \
dist/aws_opentelemetry_distro-$pkg_version-py3-none-any.whl
# The step below publishes to testpypi in order to catch any issues
# with the package configuration that would cause a failure to upload to pypi.
- name: Publish to TestPyPI
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ steps.pypi_secrets.outputs.TEST_PYPI_TOKEN }}
run: |
pip install --upgrade twine
twine upload --repository testpypi --skip-existing --verbose dist/aws_opentelemetry_distro-${{ steps.create_release.outputs.ADOT_PYTHON_VERSION }}-py3-none-any.whl
#TODO: Uncomment "Publish to PyPI" after test release_build workflow.
# - name: Publish to PyPI
# env:
# TWINE_USERNAME: '__token__'
# TWINE_PASSWORD: ${{ steps.pypi_secrets.outputs.PROD_PYPI_TOKEN }}
# run: |
# twine upload --skip-existing --verbose dist/aws_opentelemetry_distro-${{ steps.create_release.outputs.ADOT_PYTHON_VERSION }}-py3-none-any.whl