Skip to content

build sdist step coorection #83

build sdist step coorection

build sdist step coorection #83

Workflow file for this run

name: Build and deploy wheels to pypi
on:
push:
branches:
- main
tags:
- 20*
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Describe Tag & Branch Name
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/20')
id: build_names
shell: bash
run: |
cd python
echo ${GITHUB_REF#refs/tags/} >VERSION
- name: Configure Environment
shell: bash
run: |
cd python
cp ../release_notes.md .
cp -r ../lib .
cp -r ../third_party .
mkdir app
cp -r ../app/tng app
- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: python
env:
CIBW_SKIP: "cp27-* cp36-* cp37-* pp37-* *-musllinux* pp*-macosx*"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
CIBW_BEFORE_BUILD_LINUX: "yum update -y && yum install -y libusb-devel"
CIBW_BUILD_VERBOSITY: 3
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_MACOS: "x86_64 arm64"
# Skip trying to test arm64 builds on Intel Macs
CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64"
CMAKE_OSX_ARCHITECTURES: "arm64;x86_64"
- uses: actions/upload-artifact@v4
with:
path: wheelhouse/*.whl
overwrite: true
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.x'
- name: Describe Tag & Branch Name
id: build_names
run: |
# Only set TAG_NAME if the event is a tag push
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo TAG_NAME=${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT
else
echo "This event is not a tag push. Skipping sdist build."
exit 1 # Exit if not a tag
fi
- name: Build sdist
run: |
echo $TAG_NAME
cd python
echo $TAG_NAME >VERSION
cp -r ../lib .
cp -r ../third_party .
mkdir app
cp -r ../app/tng app
python -m pip install --upgrade pip
python -m pip install build
python -m build
env:
TAG_NAME: ${{ steps.build_names.outputs.TAG_NAME }}
- uses: actions/upload-artifact@v4
with:
path: python/dist/*.tar.gz
overwrite: true
upload_pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/20')
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
name: artifact
path: dist
- name: Production Release
if: startsWith(github.repository, 'MicrochipTech')
uses: pypa/gh-action-pypi-publish@release/v1.10
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
- name: Test Release
if: ${{ !startsWith(github.repository, 'MicrochipTech') }}
uses: pypa/gh-action-pypi-publish@release/v1.10
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true