-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (42 loc) · 1.53 KB
/
test_release_publish.yml
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
name: Build, Test, Publish Github and PyPI Releases
on:
workflow_dispatch:
jobs:
publish_github_release_and_pypi:
strategy:
matrix:
os: [ 'ubuntu-latest' ]
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
runs-on: ${{ matrix.os }}
steps:
- uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Install Poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: poetry install
- name: Run lint
run: poetry run black --check . && poetry run isort --check-only .
- name: Run tests
run: poetry run pytest --cov=sigma --cov-report term --cov-report xml:cov.xml -vv
- name: Build packages
run: poetry build
- name: Create Github Release
run: |
export NEW_VERSION=$(cat VERSION)
git config user.name "dac-bot"
git config user.email "[email protected]"
gh release create v$NEW_VERSION dist/* -t v$NEW_VERSION --draft
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Poetry
run: |
poetry config pypi-token.pypi "${{ secrets.PYPI_API_TOKEN }}"
- name: Publish to PyPI
run: poetry publish