Repository navigation
81 lines (76 loc) · 2.14 KB
/
Copy pathbuild.yml
File metadata and controls
81 lines (76 loc) · 2.14 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Build distributions
on:
push:
branches: [main]
paths-ignore:
- '**.md'
- 'docs/**'
- 'LICENSE'
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2022]
python: ['3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: python -m pip install . pytest
- run: python -m pytest -q
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: A release tag is v plus the package version
if: github.event_name == 'release'
run: |
version=$(grep -Po '^__version__ = "\K[^"]+' pyeasydeploy/__init__.py)
test "${{ github.event.release.tag_name }}" = "v$version" || {
echo "Release tag ${{ github.event.release.tag_name }} is not v$version (pyeasydeploy/__init__.py)"
exit 1
}
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- run: python -m pip install build twine pytest
- name: Build sdist and wheel
run: python -m build
- run: python -m twine check dist/*
- name: Test the built wheel
run: |
python -m pip install dist/*.whl
python -m pytest -q
- uses: actions/upload-artifact@v4
with:
name: dist-python
path: dist/*
if-no-files-found: error
publish_to_pypi:
name: Publish to PyPI
needs: [build]
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
environment: pypi-release
permissions:
id-token: write
concurrency:
group: pypi-release
cancel-in-progress: false
steps:
- uses: actions/download-artifact@v4
with:
pattern: dist-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1