Skip to content

Commit 6924a0e

Browse files
committed
chore: build wheels with new version in python-release
1 parent a23270a commit 6924a0e

2 files changed

Lines changed: 90 additions & 44 deletions

File tree

.github/workflows/python-release.yaml

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,58 +17,68 @@ permissions:
1717
- 'patch'
1818

1919
jobs:
20-
# test:
21-
# name: Build and test
22-
# uses: ./.github/workflows/python-test.yaml
23-
# secrets: inherit
20+
get_version:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
new_version: ${{ steps.increment_version.outputs.new_version }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
2428

25-
publish:
26-
defaults:
27-
run:
28-
working-directory: impit-python
29-
name: Publish
30-
runs-on: ubuntu-latest
31-
# needs: [test]
32-
steps:
33-
- uses: actions/checkout@v4
34-
with:
35-
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
29+
- name: Use Python
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: 3.x
3633

37-
- name: Use Python
38-
uses: actions/setup-python@v5
39-
with:
40-
python-version: 3.x
34+
- name: Set up uv package manager
35+
uses: astral-sh/setup-uv@v5
4136

42-
- name: Set up uv package manager
43-
uses: astral-sh/setup-uv@v5
37+
- name: Use Node.js
38+
uses: actions/setup-node@v4
4439

45-
- name: Use Node.js
46-
uses: actions/setup-node@v4
40+
- name: Get current version
41+
id: get_version
42+
working-directory: impit-python
43+
run: |
44+
echo "current_version=$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version)" >> "$GITHUB_OUTPUT"
4745
48-
- name: Get current version
49-
id: get_version
50-
working-directory: impit-python
51-
run: |
52-
echo "current_version=$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version)" >> "$GITHUB_OUTPUT"
46+
- name: Increment version
47+
id: increment_version
48+
working-directory: impit-python
49+
run: |
50+
echo "new_version=$(npx semver -i ${{ github.event.inputs.bump }} ${{ steps.get_version.outputs.current_version }})" >> "$GITHUB_OUTPUT"
5351
54-
- name: Increment version
55-
id: increment_version
56-
working-directory: impit-python
57-
run: |
58-
echo "new_version=$(npx semver -i ${{ github.event.inputs.bump }} ${{ steps.get_version.outputs.current_version }})" >> "$GITHUB_OUTPUT"
52+
- name: Set new version
53+
id: show_new_version
54+
working-directory: impit-python
55+
run: |
56+
echo "New version is ${{ steps.increment_version.outputs.new_version }}"
5957
60-
- name: Show new version
61-
id: show_new_version
62-
working-directory: impit-python
63-
run: |
64-
echo "New version is ${{ steps.increment_version.outputs.new_version }}"
58+
test:
59+
needs: [get_version]
60+
name: Build and test
61+
uses: ./.github/workflows/python-test.yaml
62+
secrets: inherit
63+
with:
64+
version: ${{ needs.get_version.outputs.new_version }}
6565

66+
publish:
67+
defaults:
68+
run:
69+
working-directory: impit-python
70+
name: Publish
71+
runs-on: ubuntu-latest
72+
needs: [test]
73+
steps:
6674
- name: Download all artifacts
6775
uses: actions/download-artifact@v4
6876
with:
6977
path: impit-python/dist
70-
run-id: 14217710491
71-
github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
78+
79+
- name: Unzip artifacts
80+
run: |
81+
unzip -o impit-python/dist/*.zip -d impit-python/dist
7282
7383
- name: List files
7484
run: |

.github/workflows/python-test.yaml

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ on:
2222
- 'Cargo.*'
2323
workflow_dispatch:
2424
workflow_call:
25+
inputs:
26+
version:
27+
description: 'Version to set in pyproject.toml and wheel metadata'
28+
required: false
29+
type: string
30+
default: ''
2531

2632
permissions:
2733
contents: read
@@ -51,6 +57,13 @@ jobs:
5157
- name: Set up Python
5258
run: uv python install
5359

60+
- name: Set new version
61+
if: ${{ inputs.version != '' }}
62+
id: set_version
63+
working-directory: impit-python
64+
run: |
65+
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version ${{ inputs.version }}
66+
5467
- name: Calculate openssl-vendored
5568
shell: bash
5669
id: is-openssl-vendored
@@ -66,7 +79,7 @@ jobs:
6679
with:
6780
working-directory: impit-python
6881
target: ${{ matrix.platform.target }}
69-
args: --release --out dist --find-interpreter
82+
args: --release --out dist --find-interpreter --sdist
7083
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
7184
manylinux: auto
7285
before-script-linux: |
@@ -137,9 +150,18 @@ jobs:
137150
steps:
138151
- uses: actions/checkout@v4
139152

140-
- uses: actions/setup-python@v5
141-
with:
142-
python-version: 3.x
153+
- name: Install uv
154+
uses: astral-sh/setup-uv@v5
155+
156+
- name: Set up Python
157+
run: uv python install
158+
159+
- name: Set new version
160+
if: ${{ inputs.version != '' }}
161+
id: set_version
162+
working-directory: impit-python
163+
run: |
164+
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version ${{ inputs.version }}
143165
144166
- name: Build wheels
145167
uses: PyO3/maturin-action@v1
@@ -215,6 +237,13 @@ jobs:
215237
python-version: 3.x
216238
architecture: ${{ matrix.platform.target }}
217239

240+
- name: Set new version
241+
if: ${{ inputs.version != '' }}
242+
id: set_version
243+
working-directory: impit-python
244+
run: |
245+
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version ${{ inputs.version }}
246+
218247
- name: Build wheels
219248
uses: PyO3/maturin-action@v1
220249
with:
@@ -261,6 +290,13 @@ jobs:
261290
- name: Set up Python
262291
uses: actions/setup-python@v5
263292

293+
- name: Set new version
294+
if: ${{ inputs.version != '' }}
295+
id: set_version
296+
working-directory: impit-python
297+
run: |
298+
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version ${{ inputs.version }}
299+
264300
- name: Build wheels
265301
uses: PyO3/maturin-action@v1
266302
with:

0 commit comments

Comments
 (0)