Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,11 @@ jobs:
subject-path: |
./*.tar.gz
./*.whl
- uses: actions/setup-python@v6
- uses: astral-sh/setup-uv@v7
if: startsWith(github.ref, 'refs/tags/')
with:
python-version: "3.10"
- name: Publish
if: startsWith(github.ref, 'refs/tags/')
run: |
pip install maturin
maturin upload --skip-existing *
run: uv publish '*'
- name: Set environment url
id: set_url
run: |
Expand Down
63 changes: 33 additions & 30 deletions src/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,15 +658,18 @@ jobs:\n",
"#,
);
}
conf.push_str(
r#" - name: Install uv
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: astral-sh/setup-uv@v7
"#,
);
conf.push_str(
r#" - name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: PyO3/maturin-action@v1
run: uv publish 'wheels-*/*'
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
Comment on lines +670 to +672

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we should suggest secure defaults and add --trusted-publishing always to the default command here, removing the UV_PUBLISH_TOKEN env var

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in next version so this version is a smooth upgrade

"#,
);
if platforms.contains(&Platform::Emscripten) {
Expand Down Expand Up @@ -892,14 +895,14 @@ mod tests {
uses: actions/attest-build-provenance@v3
with:
subject-path: 'wheels-*/*'
- name: Install uv
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: astral-sh/setup-uv@v7
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: PyO3/maturin-action@v1
run: uv publish 'wheels-*/*'
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*"#]];
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]];
expected.assert_eq(&conf);
}

Expand Down Expand Up @@ -1110,14 +1113,14 @@ mod tests {
uses: actions/attest-build-provenance@v3
with:
subject-path: 'wheels-*/*'
- name: Install uv
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: astral-sh/setup-uv@v7
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: PyO3/maturin-action@v1
run: uv publish 'wheels-*/*'
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*"#]];
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]];
expected.assert_eq(&conf);
}

Expand Down Expand Up @@ -1325,14 +1328,14 @@ mod tests {
contents: write
steps:
- uses: actions/download-artifact@v6
- name: Install uv
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: astral-sh/setup-uv@v7
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: PyO3/maturin-action@v1
run: uv publish 'wheels-*/*'
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*"#]];
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]];
expected.assert_eq(&conf);
}

Expand Down Expand Up @@ -1605,14 +1608,14 @@ mod tests {
uses: actions/attest-build-provenance@v3
with:
subject-path: 'wheels-*/*'
- name: Install uv
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: astral-sh/setup-uv@v7
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: PyO3/maturin-action@v1
run: uv publish 'wheels-*/*'
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*"#]];
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]];
expected.assert_eq(&conf);
}

Expand Down Expand Up @@ -1786,14 +1789,14 @@ mod tests {
uses: actions/attest-build-provenance@v3
with:
subject-path: 'wheels-*/*'
- name: Install uv
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: astral-sh/setup-uv@v7
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: PyO3/maturin-action@v1
run: uv publish 'wheels-*/*'
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*"#]];
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}"#]];
expected.assert_eq(&conf);
}
}
11 changes: 11 additions & 0 deletions src/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ impl PublishOpt {
/// Set to non interactive mode if we're running on CI
pub fn non_interactive_on_ci(&mut self) {
if !self.non_interactive && env::var("CI").map(|v| v == "true").unwrap_or_default() {
let msg = "⚠️ Warning: The maturin upload and publish commands are deprecated and will be removed in the future. For more information see: https://github.com/PyO3/maturin/issues/2334";
eprintln!("{msg}");

if env::var("GITHUB_ACTIONS")
.map(|v| v == "true")
.unwrap_or_default()
{
// Also emit a warning annotation on the GH action
println!("::warning::{msg}");
}

eprintln!("🎛️ Running in non-interactive mode on CI");
self.non_interactive = true;
}
Expand Down
Loading