Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 08693d6

Browse files
Split build and publish github actions (#2)
1 parent 6475657 commit 08693d6

File tree

1 file changed

+35
-18
lines changed

1 file changed

+35
-18
lines changed

.github/workflows/publish-sdist.yml

+35-18
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,49 @@
11
name: PyPI
22

33
on:
4+
workflow_dispatch:
5+
pull_request:
46
push:
5-
tags:
6-
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
branches:
8+
- main
9+
release:
10+
types:
11+
- published
712

813
jobs:
9-
build-n-publish:
10-
name: Build and publish on PyPI
14+
build:
15+
name: Build distribution
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Build a binary wheel and a source tarball
21+
run: pipx run build
22+
- name: Check metadata
23+
run: pipx run twine check dist/*
24+
- name: Store the distribution packages
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: python-package-distributions
28+
path: dist/
29+
30+
publish-to-pypi:
31+
name: Publish Python distribution to PyPI
32+
if: github.event_name == 'release' && github.event.action == 'published'
33+
needs:
34+
- build
1135
runs-on: ubuntu-latest
1236
environment:
1337
name: pypi
1438
url: https://pypi.org/p/obp-accounting-sdk
1539
permissions:
16-
id-token: write
40+
id-token: write # IMPORTANT: mandatory for trusted publishing
41+
1742
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v4
20-
- name: Set up Python
21-
uses: actions/setup-python@v5
43+
- name: Download all the dists
44+
uses: actions/download-artifact@v4
2245
with:
23-
python-version: 3.12
24-
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip setuptools wheel
27-
python -m pip install build
28-
- name: Build distribution packages
29-
run: |
30-
python -m build
31-
- name: Publish distribution packages to PyPI
46+
name: python-package-distributions
47+
path: dist/
48+
- name: Publish distribution to PyPI
3249
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)