Debian Codegraph @

.github/workflows/release.yml

raw
1 ---
2 name: Release
3
4 # yamllint disable-line rule:truthy
5 on:
6 release:
7 types:
8 - published
9
10 jobs:
11 build:
12 name: Build distribution
13 runs-on: ubuntu-latest
14 steps:
15 - name: โคต๏ธ Check out code from GitHub
16 uses: actions/checkout@v4
17 - name: ๐Ÿ— Set up uv
18 uses: astral-sh/setup-uv@v5
19 with:
20 enable-cache: true
21 - name: ๐Ÿ— Set up Python
22 run: uv python install
23 - name: โœ… Verify version matches release tag
24 run: |
25 tag="${GITHUB_REF_NAME#v}"
26 version="$(uv version --short)"
27 if [ "${tag}" != "${version}" ]; then
28 echo "Release tag ${GITHUB_REF_NAME} does not match" \
29 "project version ${version}" >&2
30 exit 1
31 fi
32 - name: ๐Ÿš€ Build sdist and wheel
33 run: uv build
34 - name: ๐Ÿงช Install built wheel and import package
35 run: |
36 uv venv /tmp/install-test
37 uv pip install --python /tmp/install-test/bin/python dist/*.whl
38 /tmp/install-test/bin/python -c "import iotawattpy"
39 - name: โฌ†๏ธ Upload build artifacts
40 uses: actions/upload-artifact@v4
41 with:
42 name: dist
43 path: dist/
44
45 publish:
46 name: Publish to PyPI
47 runs-on: ubuntu-latest
48 needs: build
49 environment:
50 name: release
51 url: https://pypi.org/project/ha-iotawattpy/
52 permissions:
53 # Required for PyPI trusted publishing (OIDC)
54 id-token: write
55 steps:
56 - name: โฌ‡๏ธ Download build artifacts
57 uses: actions/download-artifact@v4
58 with:
59 name: dist
60 path: dist/
61 - name: ๐Ÿš€ Publish to PyPI
62 uses: pypa/gh-action-pypi-publish@release/v1