-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add main_build and release_build workflow.
- Loading branch information
Showing
4 changed files
with
107 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
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 | ||
env: | ||
AWS_DEFAULT_REGION: us-east-1 | ||
STAGING_ECR_REGISTRY: 637423224110.dkr.ecr.us-east-1.amazonaws.com | ||
STAGING_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@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install Dependencies and Build Wheel | ||
id: staging_wheel_build | ||
run: | | ||
pip install --upgrade pip setuptools wheel packaging build | ||
rm -rf ./dist/* | ||
cd ./aws-opentelemetry-distro | ||
python -m build --outdir ../dist | ||
cd ../dist | ||
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 | ||
pip wheel --no-deps aws_opentelemetry_distro-$pkg_version.tar.gz | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} | ||
aws-region: ${{ env.AWS_DEFAULT_REGION }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to AWS ECR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.STAGING_ECR_REGISTRY }} | ||
env: | ||
AWS_REGION: ${{ env.AWS_DEFAULT_REGION }} | ||
|
||
- name: Build and push staging image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
${{ env.STAGING_ECR_REGISTRY }}/${{ env.STAGING_ECR_REPOSITORY }}:v${{ github.event.inputs.version }} | ||
- name: Create release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
run: | | ||
cp "dist/aws_opentelemetry_distro-${{ steps.staging_wheel_build.outputs.ADOT_PYTHON_VERSION }}-py3-none-any.whl" aws_opentelemetry_distro.whl | ||
gh release create --target "$GITHUB_REF_NAME" \ | ||
--title "Release v${{ github.event.inputs.version }}" \ | ||
--draft \ | ||
"v${{ github.event.inputs.version }}" \ | ||
aws_opentelemetry_distro.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters