Skip to content

Commit 1bd522d

Browse files
committed
Automatic release
1 parent 51a6673 commit 1bd522d

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/release.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- v*
8+
9+
env:
10+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN_DIST }}
11+
12+
jobs:
13+
build:
14+
name: build release
15+
# only run on push to main and on release
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: set up python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.13"
24+
25+
- run: pip install -U twine
26+
- run: make build-release
27+
28+
test_release:
29+
runs-on: ubuntu-latest
30+
name: Test release
31+
needs: [build]
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: set up python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: "3.13"
39+
40+
- run: pip install dist/*.whl
41+
- run: python -c "from transformers import pipeline; classifier = pipeline('text-classification'); assert classifier('What a nice release')[0]['score'] > 0"
42+
- run: python -c "from transformers import *"
43+
44+
upload_package:
45+
if: startsWith(github.ref, 'refs/tags/')
46+
runs-on: ubuntu-latest
47+
steps:
48+
- run: echo "Should only run on tags"
49+
50+
51+
# upload_package:
52+
# name: Upload package to PyPi
53+
# runs-on: ubuntu-latest
54+
# needs: [build]
55+
#
56+
# steps:
57+
# - uses: actions/checkout@v4
58+
#
59+
# - name: Install Python
60+
# uses: actions/setup-python@v5
61+
# with:
62+
# python-version: "3.13"
63+
# architecture: x64
64+
#
65+
# - uses: actions/download-artifact@v4
66+
# with:
67+
# path: ./bindings/python/dist
68+
# merge-multiple: true
69+
# # Temporary deactivation while testing abi3 CI
70+
# # - name: Upload to PyPi
71+
# # working-directory: ./bindings/python
72+
# # run: |
73+
# # pip install twine
74+
# # twine upload dist/* -u __token__ -p "$PYPI_TOKEN"

0 commit comments

Comments
 (0)