mirror of
https://github.com/creyD/creyPY.git
synced 2026-04-15 04:40:36 +02:00
Added automated versioning
This commit is contained in:
21
.github/workflows/lint.yml
vendored
21
.github/workflows/lint.yml
vendored
@@ -1,9 +1,8 @@
|
|||||||
name: Lint
|
name: Lint and tag
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
|
||||||
- master
|
- master
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "**/.github/**"
|
- "**/.github/**"
|
||||||
@@ -27,3 +26,21 @@ jobs:
|
|||||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
commit_message: Adjusted files for isort & autopep
|
commit_message: Adjusted files for isort & autopep
|
||||||
|
|
||||||
|
tag:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: lint
|
||||||
|
steps:
|
||||||
|
- name: Git Version
|
||||||
|
uses: codacy/git-version@2.8.0
|
||||||
|
id: git_version
|
||||||
|
with:
|
||||||
|
prefix: v
|
||||||
|
minor-identifier: "feat:"
|
||||||
|
major-identifier: "breaking:"
|
||||||
|
|
||||||
|
- name: Create Tag
|
||||||
|
run: git tag -a v${{ steps.git_version.outputs.version }} -m "v${{ steps.git_version.outputs.version }}"
|
||||||
|
|
||||||
|
- name: Push Tag
|
||||||
|
run: git push origin v${{ steps.git_version.outputs.version }}
|
||||||
|
|||||||
29
.github/workflows/publish.yml
vendored
29
.github/workflows/publish.yml
vendored
@@ -0,0 +1,29 @@
|
|||||||
|
name: Publish to pypi
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r requirements.build.txt
|
||||||
|
|
||||||
|
- name: Build and publish
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
with:
|
||||||
|
user: __token__
|
||||||
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
|
|||||||
19
setup.py
19
setup.py
@@ -1,11 +1,28 @@
|
|||||||
|
import subprocess
|
||||||
|
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
with open("requirements.txt") as f:
|
with open("requirements.txt") as f:
|
||||||
requirements = f.read().splitlines()
|
requirements = f.read().splitlines()
|
||||||
|
|
||||||
|
|
||||||
|
def get_latest_git_tag() -> str:
|
||||||
|
try:
|
||||||
|
tag = (
|
||||||
|
subprocess.check_output(["git", "describe", "--tags", "--abbrev=0"])
|
||||||
|
.strip()
|
||||||
|
.decode("utf-8")
|
||||||
|
)
|
||||||
|
if tag.startswith("v"):
|
||||||
|
tag = tag[1:]
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
raise RuntimeError("Unable to get latest git tag")
|
||||||
|
return str(tag)
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="creyPY",
|
name="creyPY",
|
||||||
version="0.0.9",
|
version=get_latest_git_tag(),
|
||||||
description="My collection of Python and FastAPI shortcuts etc.",
|
description="My collection of Python and FastAPI shortcuts etc.",
|
||||||
author="Conrad Großer",
|
author="Conrad Großer",
|
||||||
author_email="conrad@noah.tech",
|
author_email="conrad@noah.tech",
|
||||||
|
|||||||
Reference in New Issue
Block a user