Repository navigation
56 lines (51 loc) · 1.64 KB
/
Copy pathrelease-python.yml
File metadata and controls
56 lines (51 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Release Python package
# Push a tag such as py-v0.1.0. PyPI trusts this workflow directly, so no
# token is stored anywhere.
on:
push:
tags: ["py-v*"]
# GitHub can deliver one tag push twice; the second run waits for the first.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Tag is on main
run: git merge-base --is-ancestor "$GITHUB_SHA" origin/main
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
- name: Tag matches package version
run: test "py-v$(uv version --short)" = "$GITHUB_REF_NAME"
- run: uv run --group dev ruff format --check .
- run: uv run --group dev ruff check .
- run: uv run --group dev mypy
- run: uv run --group dev pytest
- run: uv build
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: dist
path: python/dist/
publish:
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/ng-postcode/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
skip-existing: true