Skip to content

Commit 71b9754

Browse files
committed
Rework publish workflow
1 parent 42236af commit 71b9754

File tree

2 files changed

+20
-31
lines changed

2 files changed

+20
-31
lines changed

.github/workflows/deploy.yaml

+19-30
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
push:
55
tags:
66
- 'v*'
7-
release:
8-
types:
9-
- published
107

118
jobs:
129
build:
@@ -16,60 +13,52 @@ jobs:
1613
- name: Checkout code
1714
uses: actions/checkout@master
1815

19-
- name: Set up Python 3.10
16+
- name: Set up Python 3.11
2017
uses: actions/setup-python@v4
2118
with:
22-
python-version: "3.10"
19+
python-version: "3.11"
2320

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//')
3126

3227
- name: Build
33-
run: |
34-
poetry build
28+
run: python -m build .
3529

3630
- name: Try install wheel
3731
run: |
3832
mkdir -p try_install
3933
cd try_install
4034
python -m venv venv
4135
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__)"
4337
4438
- name: Publish artifacts
4539
uses: actions/upload-artifact@v2
4640
with:
47-
name: wheels
41+
name: package
4842
path: dist/*
4943

5044
publish:
5145
name: Publish
5246
needs: build
5347
if: "success() && startsWith(github.ref, 'refs/tags/')"
5448
runs-on: ubuntu-latest
49+
environment:
50+
name: pypi
51+
url: https://pypi.org/project/magic-filter/
52+
permissions:
53+
id-token: write
5554
steps:
5655
- name: Download artifacts
5756
uses: actions/download-artifact@v1
5857
with:
59-
name: wheels
58+
name: package
6059
path: dist
6160

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-
7061
- 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+

.github/workflows/test.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
- name: Set up Python 3.10
8181
uses: actions/setup-python@v4
8282
with:
83-
python-version: "3.10"
83+
python-version: "3.11"
8484

8585
- name: Install build dependencies
8686
run: python -m pip install --upgrade build

0 commit comments

Comments
 (0)