added gitea workflow and fixed some issues in pyproject.toml
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
name: Build and Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
|
||||||
|
- name: Build package
|
||||||
|
run: uv build
|
||||||
|
|
||||||
|
- name: Publish to Gitea package registry
|
||||||
|
run: |
|
||||||
|
uv publish \
|
||||||
|
--publish-url https://gitea.semrks.nl:8418/api/packages/mreurekas/pypi \
|
||||||
|
--username ${{ secrets.CI_USER }} \
|
||||||
|
--password ${{ secrets.CI_TOKEN }}
|
||||||
|
env:
|
||||||
|
UV_PUBLISH_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
# .gitea/workflows/bump-version.yaml
|
||||||
|
name: Bump Version
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
bump:
|
||||||
|
description: 'Version part to bump'
|
||||||
|
required: true
|
||||||
|
default: 'patch'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- patch
|
||||||
|
- minor
|
||||||
|
- major
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bump:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|
||||||
|
- name: Configure git
|
||||||
|
run: |
|
||||||
|
git config user.name "gitea-actions"
|
||||||
|
git config user.email "actions@semrks.nl"
|
||||||
|
|
||||||
|
- name: Bump version in pyproject.toml
|
||||||
|
id: bump
|
||||||
|
run: |
|
||||||
|
python3 - <<'EOF'
|
||||||
|
import re
|
||||||
|
|
||||||
|
bump = "${{ inputs.bump }}"
|
||||||
|
path = "pyproject.toml"
|
||||||
|
|
||||||
|
with open(path) as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
match = re.search(r'(?m)^version = "(\d+)\.(\d+)\.(\d+)"$', content)
|
||||||
|
major, minor, patch = map(int, match.groups())
|
||||||
|
|
||||||
|
if bump == "major":
|
||||||
|
major, minor, patch = major + 1, 0, 0
|
||||||
|
elif bump == "minor":
|
||||||
|
minor, patch = minor + 1, 0
|
||||||
|
else:
|
||||||
|
patch += 1
|
||||||
|
|
||||||
|
new_version = f"{major}.{minor}.{patch}"
|
||||||
|
new_content = content[:match.start()] + f'version = "{new_version}"' + content[match.end():]
|
||||||
|
|
||||||
|
with open(path, "w") as f:
|
||||||
|
f.write(new_content)
|
||||||
|
|
||||||
|
with open("$GITEA_ENV", "a") as f:
|
||||||
|
f.write(f"NEW_VERSION={new_version}\n")
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Commit and tag
|
||||||
|
run: |
|
||||||
|
git add pyproject.toml
|
||||||
|
git commit -m "Bump version to ${NEW_VERSION}"
|
||||||
|
git tag "v${NEW_VERSION}"
|
||||||
|
git push origin HEAD:${{ github.ref_name }}
|
||||||
|
git push origin "v${NEW_VERSION}"
|
||||||
+3
-2
@@ -5,7 +5,8 @@ description = "CPU Governor Auto Adjust based on Roon Activity and System Load"
|
|||||||
authors = [
|
authors = [
|
||||||
{ name = "Martin Reurekas", email = "martin@semrks.nl" }
|
{ name = "Martin Reurekas", email = "martin@semrks.nl" }
|
||||||
]
|
]
|
||||||
license = { file = "LICENSE" }
|
license = "MIT"
|
||||||
|
license-files = ["LICENSE"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@@ -23,7 +24,7 @@ dev = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
where = [".", "cpu_governor_auto_adjust"]
|
where = ["."]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
cpu_governor_auto_adjust = "cpu_governor_auto_adjust.cpu_governor_auto_adjust:main"
|
cpu_governor_auto_adjust = "cpu_governor_auto_adjust.cpu_governor_auto_adjust:main"
|
||||||
|
|||||||
Reference in New Issue
Block a user