Skip to content

Commit

Permalink
Split publish and build GHA jobs (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
facutuesca authored Oct 4, 2024
1 parent 33d3dad commit f98fe60
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
4 changes: 3 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"Proprietary"
],
"_copy_without_render": [
".github/workflows/*.yml"
".github/workflows/docs.yml",
".github/workflows/lint.yml",
".github/workflows/tests.yml"
],
"__prompts__": {
"project_name": "Human-readable project name (translated into module slug and import)",
Expand Down
43 changes: 31 additions & 12 deletions {{cookiecutter.project_slug}}/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@ on:

name: release

permissions:
# Used to sign the release's artifacts with sigstore-python.
# Used to publish to PyPI with Trusted Publishing.
id-token: write

jobs:
pypi:
name: upload release to PyPI
build:
name: Build distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -25,10 +20,34 @@ jobs:
enable-cache: true
cache-dependency-glob: pyproject.toml

- name: build
run: uvx --from build pyproject-build --installer uv
- name: Build distributions
run: uv build

- name: publish
uses: pypa/gh-action-pypi-publish@release/v1
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
attestations: true
name: distributions
path: dist/

publish:
name: Publish Python distributions to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/{{cookiecutter.project_slug}}
needs: [build]
permissions:
# Used to sign the release's artifacts with sigstore-python.
# Used to publish to PyPI with Trusted Publishing.
id-token: write
steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: distributions
path: dist/

- name: Publish distributions
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ doc:

.PHONY: package
package: $(VENV)/pyvenv.cfg
uvx --from build pyproject-build --installer uv
uv build

.PHONY: edit
edit:
Expand Down

0 comments on commit f98fe60

Please sign in to comment.