Release Actions #18
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
name: Release Actions | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
jobs: | |
upload-pypi: | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Checkout Current Repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: | | |
sudo apt install python3-dev | |
python3 -m pip install --upgrade pip | |
python3 -m pip install -r requirements.txt | |
python3 -m pip install twine | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: aarch64 armv7l | |
- name: Build wheels with cibuildwheels | |
uses: pypa/cibuildwheel@v2.21.2 | |
env: | |
CIBW_ARCHS_LINUX: aarch64 native armv7l | |
CIBW_SKIP: cp36* pp* *ppc64le *s390x | |
- name: Move cross-compiled wheels to dist folder | |
run: | | |
mkdir -p dist | |
mv ./wheelhouse/*.whl ${{ github.workspace }}/dist/ | |
- name: build source distributable wheel | |
# sdist for non-supprted platforms will serve as a stub lib install | |
run: | | |
python -m pip install build | |
python -m build -s | |
- name: Save distributable wheels as artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "pyRF24_pkg_dist" | |
path: ${{ github.workspace }}/dist | |
- name: Publish package (to TestPyPI) | |
if: github.event_name == 'workflow_dispatch' | |
uses: pypa/gh-action-pypi-publish@v1.10.3 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish to PyPi | |
# only upload distributions to PyPi when triggered by a published release | |
if: github.event_name == 'release' | |
uses: pypa/gh-action-pypi-publish@v1.10.3 |