Skip to content

Commit d3dd96a

Browse files
committed
Add united publish workflow
1 parent 02eba0d commit d3dd96a

File tree

5 files changed

+64
-125
lines changed

5 files changed

+64
-125
lines changed

.github/scripts/cargo_version_bumper.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/dry_run_publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
name: sdist
3232
path: dist
3333

34+
- name: List downloaded artifacts
35+
run: ls -lh dist/
36+
3437
- uses: dtolnay/rust-toolchain@master
3538
with:
3639
toolchain: stable

.github/workflows/publish.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish PyPi & crates.io
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Release tag"
8+
required: true
9+
release:
10+
types:
11+
- created
12+
13+
jobs:
14+
build_wheels:
15+
# TODO: switch to main
16+
uses: dottxt-ai/outlines-core/.github/workflows/build_wheels.yml@maturin
17+
with:
18+
auto_bump: true
19+
20+
release:
21+
needs: build_wheels
22+
name: Publish PyPI and crates.io
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
27+
- uses: actions/download-artifact@v4
28+
with:
29+
pattern: wheels-*
30+
merge-multiple: true
31+
path: dist
32+
33+
- uses: actions/download-artifact@v4
34+
with:
35+
name: sdist
36+
path: dist
37+
38+
- uses: dtolnay/rust-toolchain@master
39+
with:
40+
toolchain: stable
41+
- uses: Swatinem/rust-cache@v2
42+
43+
- name: Bump version in Cargo.toml
44+
uses: ./.github/actions/bump_version
45+
46+
- name: Dry-run publish to crates.io
47+
run: cargo publish --dry-run
48+
49+
- name: Publish to PyPI
50+
uses: PyO3/maturin-action@v1
51+
env:
52+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_SECRET}}
53+
with:
54+
command: upload
55+
args: --non-interactive --skip-existing dist/*
56+
57+
- name: Publish to crates.io
58+
env:
59+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
60+
# We need --allow-dirty since we dynamically change the version in Cargo.toml
61+
run: cargo publish --allow-dirty

.github/workflows/release_pypi.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/release_rust.yaml

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)