Skip to content

Commit 79aa975

Browse files
committed
Update release workflow
1 parent 677cbbc commit 79aa975

2 files changed

Lines changed: 42 additions & 16 deletions

File tree

.github/workflows/release.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,49 @@ jobs:
1818
uses: actions/checkout@v4.1.7
1919
with:
2020
token: ${{ secrets.RELEASE_GIT_TOKEN }}
21-
- name: "Install Poetry"
22-
run: "pipx install poetry"
21+
- name: "Install uv"
22+
run: "pipx install uv"
2323
- name: "Set up Python 3.12"
2424
uses: "actions/setup-python@v5"
2525
with:
2626
python-version: "3.12"
27-
cache: "poetry"
27+
cache: "uv"
2828
- name: Update version in pyproject.toml
29+
id: version_bump
2930
run: |
30-
poetry version patch
31+
OLD_VERSION=$(awk -F ' = ' '/^version =/ {gsub(/"/, "", $2); print $2}' pyproject.toml)
32+
33+
IFS='.' read -r -a V_PARTS <<< "$OLD_VERSION"
34+
V_PARTS[2]=$((V_PARTS[2] + 1))
35+
NEW_VERSION="${V_PARTS[0]}.${V_PARTS[1]}.${V_PARTS[2]}"
36+
37+
# Using awk for safer replacement
38+
awk -v old="version = \"$OLD_VERSION\"" -v new="version = \"$NEW_VERSION\"" '{gsub(old, new)}1' pyproject.toml > pyproject.toml.tmp && mv pyproject.toml.tmp pyproject.toml
39+
40+
echo "New version: $NEW_VERSION"
41+
echo "VERSION=$NEW_VERSION" >> "$GITHUB_OUTPUT"
3142
- name: Commit and push changes
3243
run: |
3344
git config --global user.email "github@actions.com"
34-
git config --global user.name "GitHub Actions "
35-
git add .
45+
git config --global user.name "GitHub Actions"
46+
git add pyproject.toml
3647
if [[ -n "$(git diff --cached)" ]]; then
37-
git commit -m "Dump version to $(poetry version -s) [skip ci]"
48+
git commit -m "Bump version to ${{ steps.version_bump.outputs.VERSION }} [skip ci]"
3849
git push
3950
else
4051
echo "No changes to commit"
4152
fi
4253
- name: Extract version from pyproject.toml
4354
id: extract_metadata
4455
run: |
45-
VERSION=$(awk -F ' = ' '/version =/ {gsub(/"/, "", $2); print $2}' ./pyproject.toml)
46-
LABELS="version=$VERSION,latest"
47-
echo "::set-output name=version::$VERSION"
48-
echo "::set-output name=labels::$LABELS"
49-
shell: /usr/bin/bash -e {0}
56+
VERSION=$(awk -F ' = ' '/^version =/ {gsub(/"/, "", $2); print $2}' ./pyproject.toml)
57+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
58+
shell: bash
59+
- name: Build and Upload Package
60+
run: |
61+
pipx inject uv twine
62+
uv dist-build
63+
uv twine-upload --user __token__ --password ${{ secrets.PYPI_API_TOKEN }} dist/*
5064
- name: Release New Version
5165
uses: softprops/action-gh-release@v1
5266
with:

pyproject.toml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
15
[project]
26
name = "swapi-client"
3-
authors = ["Adrian Ciolek <ciolek.adrian@protonmail.com>"]
4-
version = "0.0.1"
5-
description = "A unofficial Python client for the SerwisPlanner API"
7+
version = "0.2.1"
8+
description = "API client for Serwis Planner"
69
readme = "README.md"
710
requires-python = ">=3.12"
11+
license = { file = "LICENSE" }
12+
authors = [
13+
{ name = "qwizi", email = "qwizi@qwizi.dev" },
14+
]
815
dependencies = [
9-
"httpx>=0.20.0",
16+
"httpx>=0.27.0",
17+
"python-dotenv>=1.0.1",
1018
]
19+
20+
[project.urls]
21+
Homepage = "https://github.com/qwizi/swapi-client"
22+
"Bug Tracker" = "https://github.com/qwizi/swapi-client/issues"

0 commit comments

Comments
 (0)