Skip to content

Commit d0849da

Browse files
committed
Fix upload workflow
1 parent c99e600 commit d0849da

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed
Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
name: Upload to PyPI on Release
1+
name: publish
22

33
on:
44
release:
5-
types:
6-
- created
7-
8-
env:
9-
POETRY_VERSION: "1.6.1"
5+
types: [published]
106

117
jobs:
128
build:
139
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: ["3.10"]
1413

1514
steps:
16-
- uses: actions/checkout@v3
17-
- name: Install poetry
18-
run: pipx install poetry==$POETRY_VERSION
19-
- name: Set up Python 3.10
20-
uses: actions/setup-python@v4
21-
with:
22-
python-version: "3.10"
23-
cache: "poetry"
24-
- name: Build project for distribution
25-
run: poetry build
26-
- name: Check Version
27-
id: check-version
28-
run: |
29-
echo version=$(poetry version --short) >> $GITHUB_OUTPUT
30-
- name: Create Release
31-
uses: ncipollo/release-action@v1
32-
with:
33-
artifacts: "dist/*"
34-
token: ${{ secrets.GITHUB_TOKEN }}
35-
draft: false
36-
generateReleaseNotes: true
37-
tag: v${{ steps.check-version.outputs.version }}
38-
commit: master
39-
- name: Publish to PyPI
40-
env:
41-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
42-
run: |
43-
poetry publish
15+
- uses: actions/checkout@v2
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v2.2.2
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
21+
- name: Install poetry
22+
run: make poetry-download
23+
24+
- name: Set up cache
25+
uses: actions/cache@v2.1.6
26+
with:
27+
path: .venv
28+
key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}
29+
30+
- name: Install dependencies
31+
run: |
32+
poetry config virtualenvs.in-project true
33+
poetry install
34+
35+
- name: Build
36+
run: |
37+
poetry run python3 -m build
38+
39+
- name: Publish distribution to PyPI
40+
if: startsWith(github.ref, 'refs/tags')
41+
uses: pypa/gh-action-pypi-publish@release/v1
42+
with:
43+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)