Skip to content

Commit 816f958

Browse files
authored
Merge pull request #577 from sanders41/publish-permissions
Add permissions to publish
2 parents 425b648 + 8ec15e6 commit 816f958

6 files changed

+31
-19
lines changed

Cargo.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "python-project-generator"
3-
version = "1.16.0"
3+
version = "1.16.1"
44
edition = "2021"
55
authors = ["Paul Sanders <[email protected]>"]
66
description = "Generates a Python project structure."

src/github_actions.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,9 @@ jobs:
12001200
release:
12011201
name: Release
12021202
runs-on: ubuntu-latest
1203+
permissions:
1204+
# For PyPI's trusted publishing.
1205+
id-token: write
12031206
if: "startsWith(github.ref, 'refs/tags/')"
12041207
needs: [linux, windows, macos, sdist]
12051208
steps:
@@ -1226,6 +1229,9 @@ on:
12261229
jobs:
12271230
deploy:
12281231
runs-on: ubuntu-latest
1232+
permissions:
1233+
# For PyPI's trusted publishing.
1234+
id-token: write
12291235
steps:
12301236
- uses: actions/checkout@v4
12311237
- name: Set up Python
@@ -1289,6 +1295,9 @@ on:
12891295
jobs:
12901296
deploy:
12911297
runs-on: ubuntu-latest
1298+
permissions:
1299+
# For PyPI's trusted publishing.
1300+
id-token: write
12921301
steps:
12931302
- uses: actions/checkout@v4
12941303
- name: Install Pixi
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
source: src/github_actions.rs
33
expression: content
4+
snapshot_kind: text
45
---
5-
"name: PyPi Publish\non:\n release:\n types:\n - published\njobs:\n deploy:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Pixi\n uses: prefix-dev/[email protected]\n with:\n pixi-version: v0.30.0\n - name: Set up Python\n run: pixi add python==\"3.12.*\"\n - name: Build and publish package\n run: |\n pixi exec --spec python==\"3.12.*\" --spec python-build pyproject-build\n pixi exec --spec python==\"3.12.*\" --spec twine twine upload dist/*\n"
6+
"name: PyPi Publish\non:\n release:\n types:\n - published\njobs:\n deploy:\n runs-on: ubuntu-latest\n permissions:\n # For PyPI's trusted publishing.\n id-token: write\n steps:\n - uses: actions/checkout@v4\n - name: Install Pixi\n uses: prefix-dev/[email protected]\n with:\n pixi-version: v0.30.0\n - name: Set up Python\n run: pixi add python==\"3.12.*\"\n - name: Build and publish package\n run: |\n pixi exec --spec python==\"3.12.*\" --spec python-build pyproject-build\n pixi exec --spec python==\"3.12.*\" --spec twine twine upload dist/*\n"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
source: src/github_actions.rs
33
expression: content
4+
snapshot_kind: text
45
---
5-
"name: PyPi Publish\non:\n release:\n types:\n - published\npermissions:\n contents: read\njobs:\n linux:\n runs-on: ubuntu-latest\n strategy:\n matrix:\n target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.12\"\n - name: Build wheels\n uses: PyO3/maturin-action@v1\n with:\n target: ${{ matrix.target }}\n args: --release --out dist --find-interpreter\n sccache: 'true'\n manylinux: auto\n - name: Upload wheels\n uses: actions/upload-artifact@v4\n with:\n name: wheels-linux-${{ matrix.target }}\n path: dist\n windows:\n runs-on: windows-latest\n strategy:\n matrix:\n target: [x64, x86]\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.12\"\n architecture: ${{ matrix.target }}\n - name: Build wheels\n uses: PyO3/maturin-action@v1\n with:\n target: ${{ matrix.target }}\n args: --release --out dist --find-interpreter\n sccache: 'true'\n - name: Upload wheels\n uses: actions/upload-artifact@v4\n with:\n name: wheels-windows-${{ matrix.target }}\n path: dist\n macos:\n runs-on: macos-latest\n strategy:\n matrix:\n target: [x86_64, aarch64]\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.12\"\n - name: Build wheels\n uses: PyO3/maturin-action@v1\n with:\n target: ${{ matrix.target }}\n args: --release --out dist --find-interpreter\n sccache: 'true'\n - name: Upload wheels\n uses: actions/upload-artifact@v4\n with:\n name: wheels-macos-${{ matrix.target }}\n path: dist\n sdist:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.12\"\n - name: Build sdist\n uses: PyO3/maturin-action@v1\n with:\n command: sdist\n args: --out dist\n - name: Upload sdist\n uses: actions/upload-artifact@v4\n with:\n name: wheels-sdist\n path: dist\n release:\n name: Release\n runs-on: ubuntu-latest\n if: \"startsWith(github.ref, 'refs/tags/')\"\n needs: [linux, windows, macos, sdist]\n steps:\n - uses: actions/download-artifact@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.12\"\n - name: Publish to PyPI\n uses: PyO3/maturin-action@v1\n with:\n command: upload\n args: --non-interactive --skip-existing wheels-*/*\n"
6+
"name: PyPi Publish\non:\n release:\n types:\n - published\npermissions:\n contents: read\njobs:\n linux:\n runs-on: ubuntu-latest\n strategy:\n matrix:\n target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.12\"\n - name: Build wheels\n uses: PyO3/maturin-action@v1\n with:\n target: ${{ matrix.target }}\n args: --release --out dist --find-interpreter\n sccache: 'true'\n manylinux: auto\n - name: Upload wheels\n uses: actions/upload-artifact@v4\n with:\n name: wheels-linux-${{ matrix.target }}\n path: dist\n windows:\n runs-on: windows-latest\n strategy:\n matrix:\n target: [x64, x86]\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.12\"\n architecture: ${{ matrix.target }}\n - name: Build wheels\n uses: PyO3/maturin-action@v1\n with:\n target: ${{ matrix.target }}\n args: --release --out dist --find-interpreter\n sccache: 'true'\n - name: Upload wheels\n uses: actions/upload-artifact@v4\n with:\n name: wheels-windows-${{ matrix.target }}\n path: dist\n macos:\n runs-on: macos-latest\n strategy:\n matrix:\n target: [x86_64, aarch64]\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.12\"\n - name: Build wheels\n uses: PyO3/maturin-action@v1\n with:\n target: ${{ matrix.target }}\n args: --release --out dist --find-interpreter\n sccache: 'true'\n - name: Upload wheels\n uses: actions/upload-artifact@v4\n with:\n name: wheels-macos-${{ matrix.target }}\n path: dist\n sdist:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.12\"\n - name: Build sdist\n uses: PyO3/maturin-action@v1\n with:\n command: sdist\n args: --out dist\n - name: Upload sdist\n uses: actions/upload-artifact@v4\n with:\n name: wheels-sdist\n path: dist\n release:\n name: Release\n runs-on: ubuntu-latest\n permissions:\n # For PyPI's trusted publishing.\n id-token: write\n if: \"startsWith(github.ref, 'refs/tags/')\"\n needs: [linux, windows, macos, sdist]\n steps:\n - uses: actions/download-artifact@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.12\"\n - name: Publish to PyPI\n uses: PyO3/maturin-action@v1\n with:\n command: upload\n args: --non-interactive --skip-existing wheels-*/*\n"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
source: src/github_actions.rs
33
expression: content
4+
snapshot_kind: text
45
---
5-
"name: PyPi Publish\non:\n release:\n types:\n - published\njobs:\n deploy:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Set up Python\n uses: actions/setup-python@v5\n with:\n python-version: \"3.12\"\n cache: \"pip\"\n - name: Install Dependencies\n run: |\n python -m pip install -U pip\n python -m pip -r requirements-dev.txt\n python -m pip install build setuptools wheel twine\n - name: Build and publish package\n run: |\n python -m build\n twine upload dist/*\n"
6+
"name: PyPi Publish\non:\n release:\n types:\n - published\njobs:\n deploy:\n runs-on: ubuntu-latest\n permissions:\n # For PyPI's trusted publishing.\n id-token: write\n steps:\n - uses: actions/checkout@v4\n - name: Set up Python\n uses: actions/setup-python@v5\n with:\n python-version: \"3.12\"\n cache: \"pip\"\n - name: Install Dependencies\n run: |\n python -m pip install -U pip\n python -m pip -r requirements-dev.txt\n python -m pip install build setuptools wheel twine\n - name: Build and publish package\n run: |\n python -m build\n twine upload dist/*\n"

0 commit comments

Comments
 (0)