Skip to content

Commit 851db45

Browse files
committed
Standalone build workflow to be used by publish wokrflow and on new PRs
1 parent 703e191 commit 851db45

File tree

2 files changed

+45
-32
lines changed

2 files changed

+45
-32
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build distribution 📦
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
pull_request:
7+
8+
jobs:
9+
build-package:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- id: check_ref
13+
run: echo "::set-output name=match::$(echo '${{ github.ref }}' | grep -Pq '^refs/tags/v\d+\.\d+\.\d+$' && echo true || echo false)"
14+
shell: bash
15+
16+
- name: Check if tag is valid
17+
if: steps.check_ref.outputs.match != 'true'
18+
run: exit 1
19+
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.10"
26+
27+
- name: Install hatch
28+
run: |
29+
pip install hatch --user
30+
31+
- name: Run tests
32+
run: |
33+
python3 -m hatch run test
34+
35+
- name: Run linting
36+
run: |
37+
python3 -m hatch run lint:all
38+
39+
- name: Build a wheel and a source tarball
40+
run: |
41+
python3 -m hatch build

.github/workflows/publish.yml

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,13 @@ on:
44

55
jobs:
66
build-package:
7-
name: Build distribution 📦
8-
runs-on: ubuntu-latest
7+
uses: ./.github/workflows/build-package.yml
98

9+
upload-artifact:
10+
needs: build-package
11+
runs-on: ubuntu-latest
1012
steps:
11-
- id: check_ref
12-
run: echo "::set-output name=match::$(echo '${{ github.ref }}' | grep -Pq '^refs/tags/v\d+\.\d+\.\d+$' && echo true || echo false)"
13-
shell: bash
14-
15-
- name: Check if tag is valid
16-
if: steps.check_ref.outputs.match != 'true'
17-
run: exit 1
18-
1913
- uses: actions/checkout@v4
20-
21-
- name: Set up Python
22-
uses: actions/setup-python@v5
23-
with:
24-
python-version: "3.10"
25-
26-
- name: Install hatch
27-
run: |
28-
pip install hatch --user
29-
30-
- name: Run tests
31-
run: |
32-
python3 -m hatch run test
33-
34-
- name: Run linting
35-
run: |
36-
python3 -m hatch run lint:all
37-
38-
- name: Build a wheel and a source tarball
39-
run: |
40-
python3 -m hatch build
41-
4214
- name: Store the distribution packages
4315
uses: actions/upload-artifact@v4
4416
with:

0 commit comments

Comments
 (0)