4
4
push :
5
5
tags :
6
6
- ' v*'
7
- release :
8
- types :
9
- - published
10
7
11
8
jobs :
12
9
build :
@@ -16,60 +13,52 @@ jobs:
16
13
- name : Checkout code
17
14
uses : actions/checkout@master
18
15
19
- - name : Set up Python 3.10
16
+ - name : Set up Python 3.11
20
17
uses : actions/setup-python@v4
21
18
with :
22
- python-version : " 3.10 "
19
+ python-version : " 3.11 "
23
20
24
- - name : Install and configure Poetry
25
- uses : snok/install-poetry@v1
26
- with :
27
- version : 1.2.0
28
- virtualenvs-create : false
29
- virtualenvs-in-project : false
30
- installer-parallel : true
21
+ - name : Install build dependencies
22
+ run : python -m pip install --upgrade build hatch
23
+
24
+ - name : Bump version
25
+ run : hatch version $(echo ${{ github.ref }} | sed -e 's/refs\/tags\/v//')
31
26
32
27
- name : Build
33
- run : |
34
- poetry build
28
+ run : python -m build .
35
29
36
30
- name : Try install wheel
37
31
run : |
38
32
mkdir -p try_install
39
33
cd try_install
40
34
python -m venv venv
41
35
venv/bin/pip install ../dist/magic_filter-*.whl
42
- venv/bin/python -c "import magic_filter; print(magic_filter)"
36
+ venv/bin/python -c "import magic_filter; print(magic_filter.__version__ )"
43
37
44
38
- name : Publish artifacts
45
39
uses : actions/upload-artifact@v2
46
40
with :
47
- name : wheels
41
+ name : package
48
42
path : dist/*
49
43
50
44
publish :
51
45
name : Publish
52
46
needs : build
53
47
if : " success() && startsWith(github.ref, 'refs/tags/')"
54
48
runs-on : ubuntu-latest
49
+ environment :
50
+ name : pypi
51
+ url : https://pypi.org/project/magic-filter/
52
+ permissions :
53
+ id-token : write
55
54
steps :
56
55
- name : Download artifacts
57
56
uses : actions/download-artifact@v1
58
57
with :
59
- name : wheels
58
+ name : package
60
59
path : dist
61
60
62
- - name : Publish a Python distribution to Test PyPI
63
- uses : pypa/gh-action-pypi-publish@master
64
- if : github.event.action != 'published'
65
- with :
66
- user : __token__
67
- password : ${{ secrets.PYPI_TEST_TOKEN }}
68
- repository_url : https://test.pypi.org/legacy/
69
-
70
61
- name : Publish a Python distribution to PyPI
71
- uses : pypa/gh-action-pypi-publish@master
72
- if : github.event.action == 'published'
73
- with :
74
- user : __token__
75
- password : ${{ secrets.PYPI_TOKEN }}
62
+ uses : pypa/gh-action-pypi-publish@release/v1
63
+
64
+
0 commit comments