Skip to content

Commit 153c65b

Browse files
author
Alan Christie
committed
ci: Adds (untested) publish action
1 parent d937e2b commit 153c65b

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151
- name: Test
5252
run: |
5353
poetry run pre-commit run --all-files
54-
poetry run coverage run -m pytest
54+
poetry run coverage run --module pytest
5555
poetry run coverage report
5656
- name: Build
5757
run: |
58-
poetry build
58+
poetry build --format wheel

.github/workflows/publish.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: publish
3+
4+
# Actions for any tag.
5+
6+
# -----------------
7+
# Control variables (GitHub Secrets)
8+
# -----------------
9+
#
10+
# At the GitHub 'organisation' or 'project' level you must have the following
11+
# GitHub 'Repository Secrets' defined (i.e. via 'Settings -> Secrets'): -
12+
#
13+
# PYPI_USERNAME
14+
# PYPI_TOKEN
15+
#
16+
# -----------
17+
# Environment (GitHub Environments)
18+
# -----------
19+
#
20+
# Environment (none)
21+
22+
on:
23+
push:
24+
tags:
25+
- '**'
26+
27+
env:
28+
POETRY_VERSION: '1.8.3'
29+
30+
jobs:
31+
build-and-publish:
32+
runs-on: ubuntu-latest
33+
permissions:
34+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
- name: Inject slug/short variables
39+
uses: rlespinasse/github-slug-action@v4
40+
- name: Set up Python
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: '3.12'
44+
- name: Install dependencies
45+
run: |
46+
python -m pip install --upgrade pip
47+
pip install --no-cache-dir poetry==$POETRY_VERSION
48+
poetry install --with dev --no-root --no-directory
49+
- name: Build
50+
run: |
51+
poetry version $GITHUB_REF_SLUG
52+
poetry build --format wheel
53+
- name: Publish
54+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)