Skip to content

Commit

Permalink
Merge pull request #68 from alan-turing-institute/automate-pypi-upload
Browse files Browse the repository at this point in the history
Automate pypi upload
  • Loading branch information
jemrobinson authored Jan 21, 2025
2 parents f0b296e + a8077d5 commit 522dfa3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: 3.12
- name: Install hatch
run: pip install hatch
- name: Lint Python
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_docker.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Build Docker image
name: Publish Docker image

# Run workflow on pushes to matching branches
on: # yamllint disable-line rule:truthy
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/publish_pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Upload to PyPI

# Run workflow on pushes to matching branches
on: # yamllint disable-line rule:truthy
workflow_dispatch:
release:
types: [published]

jobs:
build-and-publish-to-pypi:
name: Build distribution and publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12

- name: Install hatch
run: pip install hatch

- name: Build with hatch
run: hatch build

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
11 changes: 4 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,19 @@ dependencies = [
typing = "mypy {args:apricot} run.py"

style = [
"black --check --diff {args:apricot} run.py",
"ruff check --preview {args:apricot} run.py",
"black --check --diff {args:apricot run.py .github}",
"ruff check --preview {args:apricot run.py .github}",
]
fmt = [
"black {args:apricot} run.py",
"ruff check --preview --fix {args:apricot} run.py",
"black {args:apricot run.py .github}",
"ruff check --preview --fix {args:apricot run.py .github}",
"style",
]
all = [
"style",
"typing",
]

[tool.black]
target-version = ["py310", "py311"]

[tool.ruff.lint]
# See https://beta.ruff.rs/docs/rules/
select = ["ALL"]
Expand Down

0 comments on commit 522dfa3

Please sign in to comment.