name: Release on: push: tags: - v* branches: - 'v*-release' permissions: contents: read jobs: build_and_test: name: build release runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: set up python uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: "3.13" - run: pip install setuptools - run: pip install -e . - run: make build-release - run: pip uninstall -y transformers - run: pip install dist/*.whl - run: python -c "from transformers import *" - run: pip install -e .[torch] - run: python -c "from transformers import pipeline; classifier = pipeline('text-classification'); assert classifier('What a nice release')[0]['score'] > 0" - run: pip install twine - run: twine check --strict dist/* - name: Upload build artifacts uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: python-dist path: | dist/** build/** upload_package: needs: build_and_test if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest environment: pypi-release permissions: id-token: write steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Download build artifacts uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: name: python-dist path: . - name: Publish package distributions to TestPyPI uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1 with: verbose: true