Skip to content

TestPypi upload

TestPypi upload #8

Workflow file for this run

name: Release
on:
push:
tags:
- v*
branches:
- v*
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN_DIST }}
jobs:
build_and_test:
name: build release
# only run on push to main and on release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- run: pip install -U twine 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"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
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:
# IMPORTANT: this permission is mandatory for Trusted Publishing
id-token: write
steps:
- uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: python-dist
path: . # will recreate dist/ and build/ here
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/