mirror of
https://github.com/qilingframework/qiling.git
synced 2026-10-12 02:21:40 +00:00
74 lines
2.2 KiB
YAML
74 lines
2.2 KiB
YAML
name: PyPI 📦 Distribution
|
|
|
|
on: [push, pull_request]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: "3.13"
|
|
- name: Install dependencies
|
|
run: python -m pip install "poetry>=2,<3" build twine
|
|
- name: Check package metadata
|
|
run: poetry check --lock
|
|
- name: Check release tag matches package version
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
env:
|
|
RELEASE_TAG: ${{ github.ref_name }}
|
|
run: |
|
|
python - <<'PY'
|
|
import os
|
|
import tomllib
|
|
from pathlib import Path
|
|
from packaging.version import Version
|
|
|
|
tag = os.environ['RELEASE_TAG'].removeprefix('v')
|
|
version = tomllib.loads(Path('pyproject.toml').read_text())['tool']['poetry']['version']
|
|
if Version(tag) != Version(version):
|
|
raise SystemExit(f'Release tag {tag!r} does not match package version {version!r}')
|
|
PY
|
|
- name: Build distribution 📦
|
|
run: python -m build
|
|
- name: Check distribution metadata
|
|
run: python -m twine check --strict dist/*
|
|
- name: Test installed wheel
|
|
run: |
|
|
python -m pip install dist/*.whl
|
|
python -I tests/test_qltool.py InstalledQltool_Test -v
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: distributions
|
|
path: ${{ github.workspace }}/dist/*
|
|
if-no-files-found: error
|
|
|
|
publish:
|
|
needs: [build]
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: distributions
|
|
path: dist
|
|
|
|
- name: Publish distribution 📦 to test PyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.testpypi_pass }}
|
|
repository-url: https://test.pypi.org/legacy/
|
|
skip-existing: true
|
|
|
|
- name: Publish distribution 📦 to PyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.pypi_pass }}
|