-
Notifications
You must be signed in to change notification settings - Fork 14
67 lines (56 loc) · 1.75 KB
/
Copy pathpublish.yml
File metadata and controls
67 lines (56 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Publish to PyPI
on:
pull_request:
types: [closed]
branches:
- master
permissions:
contents: write
id-token: write
jobs:
publish:
# Run only after PR is merged with release labels
if: |
github.event.pull_request.merged == true && (
contains(github.event.pull_request.labels.*.name, 'release:major') ||
contains(github.event.pull_request.labels.*.name, 'release:minor') ||
contains(github.event.pull_request.labels.*.name, 'release:patch')
)
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tools
run: pip install bump-my-version build
- name: Extract version
id: version
run: |
VERSION=$(bump-my-version show current_version)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
name: v${{ steps.version.outputs.version }}
body_path: CHANGELOG.md
generate_release_notes: false
- name: Build package
run: python -m build
- name: Publish to TestPyPI
id: test-pypi
uses: pypa/gh-action-pypi-publish@v1.13.0
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
attestations: false
- name: Publish to PyPI
if: steps.test-pypi.outcome == 'success'
uses: pypa/gh-action-pypi-publish@v1.13.0
with:
skip-existing: true