Skip to content

v11.0.0

v11.0.0 #30

Workflow file for this run

# Copyright 2010 New Relic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
name: Deploy
on:
release:
types:
- published
permissions:
contents: read
jobs:
build-linux-py3:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
wheel:
- cp38-manylinux
- cp38-musllinux
- cp39-manylinux
- cp39-musllinux
- cp310-manylinux
- cp310-musllinux
- cp311-manylinux
- cp311-musllinux
- cp312-manylinux
- cp312-musllinux
- cp313-manylinux
- cp313-musllinux
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
with:
persist-credentials: false
fetch-depth: 0
- name: Setup QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # 3.6.0
- name: Build Wheels
uses: pypa/cibuildwheel@faf86a6ed7efa889faf6996aa23820831055001a # 2.23.3
env:
CIBW_PLATFORM: linux
CIBW_BUILD: "${{ matrix.wheel }}*"
CIBW_ARCHS_LINUX: x86_64 aarch64
CIBW_ENVIRONMENT: "LD_LIBRARY_PATH=/opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/rh/devtoolset-8/root/usr/lib64/dyninst:/opt/rh/devtoolset-8/root/usr/lib/dyninst:/usr/local/lib64:/usr/local/lib"
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "PYTHONPATH={project}/tests pytest {project}/tests/agent_unittests -vx"
- name: Upload Artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # 4.6.2
with:
name: ${{ github.job }}-${{ matrix.wheel }}
path: ./wheelhouse/*.whl
if-no-files-found: error
retention-days: 1
build-sdist:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # 6.0.0
with:
python-version: "3.12"
- name: Install Dependencies
run: |
pip install -U pip
pip install -U build
- name: Build Source Package
run: |
python -m build --sdist
- name: Prepare MD5 Hash File
run: |
tarball="$(basename ./dist/*.tar.gz)"
md5_file="${tarball}.md5"
openssl md5 -binary "dist/${tarball}" | xxd -p | tr -d '\n' > "dist/${md5_file}"
- name: Upload Artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # 4.6.2
with:
name: ${{ github.job }}-sdist
path: |
./dist/*.tar.gz
./dist/*.tar.gz.md5
if-no-files-found: error
retention-days: 1
publish:
runs-on: ubuntu-24.04
environment: pypi
permissions:
contents: read
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
attestations: write
needs:
- build-linux-py3
- build-sdist
steps:
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # 5.0.0
with:
path: ./dist/
merge-multiple: true
- name: Upload Package to S3
run: |
tarball="$(basename ./dist/*.tar.gz)"
md5_file="${tarball}.md5"
aws s3 cp "dist/${md5_file}" "${S3_DST}/${md5_file}"
aws s3 cp "dist/${tarball}" "${S3_DST}/${tarball}"
rm "dist/${md5_file}"
env:
S3_DST: s3://nr-downloads-main/python_agent/release
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-west-2
- name: Upload Package
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # 1.13.0
- name: Attest
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # 3.0.0
id: attest
with:
subject-path: |
./dist/*.whl
./dist/*.tar.gz
- name: Wait for release to be available
id: wait
run: |
sleep 60
- name: Create release tags for Lambda and K8s Init Containers
run: |
RELEASE_TITLE="New Relic Python Agent ${GITHUB_REF_NAME}.0"
RELEASE_TAG="${GITHUB_REF_NAME}.0_python"
RELEASE_NOTES="Automated release for [Python Agent ${GITHUB_REF_NAME}](https://github.com/newrelic/newrelic-python-agent/releases/tag/${GITHUB_REF_NAME})"
gh auth login --with-token <<< "$GH_RELEASE_TOKEN"
echo "newrelic/newrelic-lambda-layers - Releasing \"${RELEASE_TITLE}\" with tag ${RELEASE_TAG}"
gh release create "${RELEASE_TAG}" --title="${RELEASE_TITLE}" --repo=newrelic/newrelic-lambda-layers --notes="${RELEASE_NOTES}"
echo "newrelic/newrelic-agent-init-container - Releasing \"${RELEASE_TITLE}\" with tag ${RELEASE_TAG}"
gh release create "${RELEASE_TAG}" --title="${RELEASE_TITLE}" --repo=newrelic/newrelic-agent-init-container --notes="${RELEASE_NOTES}"
env:
GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}