-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.19 KB
/
publish.yml
File metadata and controls
49 lines (40 loc) · 1.19 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
name: Publish to PyPI
on:
push:
tags:
- "*" # Triggers on tags like v1.0.0, v1.2.3, etc.
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/laygo
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Extract version from tag
id: version
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION=${TAG_NAME#v}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Extracted version: ${VERSION}"
- name: Update version in __init__.py
run: |
sed -i 's|"0.1.0"|"${{ steps.version.outputs.VERSION }}"|g' pyproject.toml
echo "Updated version to ${{ steps.version.outputs.VERSION }}"
cat pyproject.toml
- name: Build package
run: uv build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1