-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (44 loc) · 1.39 KB
/
Copy pathpython-publish.yml
File metadata and controls
58 lines (44 loc) · 1.39 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
name: Publish Python Package
on:
push:
tags:
- "v*"
permissions:
contents: write
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
environment:
name: pypi
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Poetry
run: pip install poetry
- name: Set version and Commit
run: |
TAG=${GITHUB_REF#refs/tags/}
VERSION=${TAG#v}
poetry version "$VERSION"
# Configure git to use the GitHub Actions bot identity
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Stage the change and commit
git add pyproject.toml
git commit -m "chore: bump version to $VERSION on release [skip ci]"
# Push the change back to the main branch
# (Assuming your default branch is 'main')
git push origin HEAD:main
- name: Install dependencies
run: poetry install --no-interaction --no-root
- name: Build package
run: poetry build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/