Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows/release: split jobs #15

Merged
merged 3 commits into from
Oct 4, 2024
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
63 changes: 41 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,52 @@ on:

name: release

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

# Used to attach signing artifacts to the published release.
contents: write
permissions: {}

jobs:
pypi:
name: upload release to PyPI
build:
name: Build distributions 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4

- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
with:
python-version-file: pyproject.toml
cache: "pip"
cache-dependency-path: pyproject.toml

- name: Install pypa/build
run: python -m pip install -U build

- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Build distributions
run: python -m build

- name: deps
run: python -m pip install -U build
- name: Upload distributions
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
with:
name: distributions
path: dist/

- name: build
run: python -m build

- name: publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
publish:
name: Publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/rfc8785
needs: [build]
permissions:
id-token: write # trusted publishing + attestations

steps:
- name: Download distributions
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: distributions
path: dist/

- name: publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ dev: $(VENV)/pyvenv.cfg

$(VENV)/pyvenv.cfg: pyproject.toml
# Create our Python 3 virtual environment
python3 -m venv env
# NOTE(ekilmer): interrogate v1.5.0 needs setuptools when using Python 3.12+.
# This should be fixed when the next release is made
$(VENV_BIN)/python -m pip install --upgrade pip setuptools
python -m venv env
$(VENV_BIN)/python -m pip install -e .[$(INSTALL_EXTRA)]

.PHONY: lint
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[build-system]
requires = ["flit_core >=3.5,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "rfc8785"
dynamic = ["version"]
Expand All @@ -19,6 +15,9 @@ classifiers = [
dependencies = []
requires-python = ">=3.8"

[tool.setuptools.dynamic]
version = { attr = "rfc8785.__version__" }

[project.optional-dependencies]
doc = ["pdoc"]
test = ["pytest", "pytest-cov", "coverage"]
Expand Down