-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (58 loc) · 1.91 KB
/
build_test_publish.yml
File metadata and controls
74 lines (58 loc) · 1.91 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
name: Build, Test and publish
on:
push:
branches:
- '*'
tags:
- '*'
jobs:
tox:
name: Run Tox python-${{ matrix.version }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '3.12'
- '3.11'
- '3.10'
os:
- ubuntu-22.04
- ubuntu-22.04-arm
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}
- name: install dependencies
run: |
pip install -r requirements.txt -r dev-requirements.txt
- name: Run tox checks
run: tox
publish:
name: Upload package to PYPI
runs-on: ubuntu-24.04
needs: tox
if: startsWith(github.ref, 'refs/tags/')
environment:
name: pypi
url: https://pypi.org/p/example_plugin # change example_plugin to your project's name
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12.8
- name: build package
run: |
python3 -m pip install --upgrade build
python3 -m build
- name: Publish to PYPI
uses: pypa/gh-action-pypi-publish@release/v1
# to properly publish that take a look at:
# https://github.com/marketplace/actions/pypi-publish
# https://medium.com/@blackary/publishing-a-python-package-from-github-to-pypi-in-2024-a6fb8635d45d