Skip to content

Workflow file for this run

name: Publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI
on:
release:
types: ['released']
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Get version number
id: v
run: |
export VERSION_NUMBER=${GITHUB_REF/refs\/tags\/v}
echo $VERSION_NUMBER > VERSION
echo "::set-output name=VERSION::${VERSION_NUMBER}"
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: πŸš€ Upload Release Asset
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/qfieldcloud_sdk-${{ steps.v.outputs.VERSION }}-py3-none-any.whl
asset_name: dist/qfieldcloud_sdk-${{ steps.v.outputs.VERSION }}-py3-none-any.whl
asset_content_type: application/binary
- name: Publish distribution πŸ“¦ to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}