Repository navigation
67 lines (62 loc) · 1.81 KB
/
Copy pathrelease-python.yml
File metadata and controls
67 lines (62 loc) · 1.81 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
name: Release Python
on:
push:
tags: [miniconf-mqtt-v*]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release-python-${{ github.ref }}
cancel-in-progress: false
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-python@v7
with:
python-version: "3.11"
- name: Check release tag
if: github.event_name == 'push'
run: |
git merge-base --is-ancestor HEAD origin/main
python - <<'PY'
import os, tomllib
from pathlib import Path
version = tomllib.loads(Path("py/pyproject.toml").read_text())["project"]["version"]
assert os.environ["GITHUB_REF_NAME"] == f"miniconf-mqtt-v{version}"
PY
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build and test distributions
run: |
sudo apt-get update
sudo apt-get install -y mosquitto
sudo service mosquitto start
cargo build -p miniconf_mqtt --example miniconf
python -m pip install build
python -m build py
python -m pip install py/dist/*.whl paho-mqtt
python -I -m unittest discover -s py/tests
python -I py/test.py
miniconf --help
- uses: actions/upload-artifact@v7
with:
name: python-dist
path: py/dist/*
if-no-files-found: error
publish:
if: github.event_name == 'push'
needs: validate
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: python-dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1