1 Commits
Author SHA1 Message Date
shmyga 7e4d665666 ci(version): 0.4.1
test / test (push) Successful in 1m25s
2026-10-08 12:44:02 +03:00
14 changed files with 24 additions and 90 deletions
+2 -2
View File
@@ -5,8 +5,8 @@ on:
tags: ["*"] tags: ["*"]
env: env:
POETRY_HTTP_BASIC_INFERNALGAMES_USERNAME: ${{ vars.PUBLISH_USERNAME }} POETRY_HTTP_BASIC_InfernalGames_USERNAME: ${{ vars.PUBLISH_USERNAME }}
POETRY_HTTP_BASIC_INFERNALGAMES_PASSWORD: ${{ secrets.PUBLISH_TOKEN }} POETRY_HTTP_BASIC_InfernalGames_PASSWORD: ${{ secrets.PUBLISH_TOKEN }}
jobs: jobs:
release: release:
-10
View File
@@ -1,7 +1,5 @@
# Project Manager # Project Manager
[![test](https://git.shmyga.ru/InfernalGames/project-manager/actions/workflows/test.yaml/badge.svg?branch=master)](https://git.shmyga.ru/InfernalGames/project-manager/actions?workflow=test.yaml)
Automatically detects modules and executes commands Automatically detects modules and executes commands
Supported types: Supported types:
@@ -12,18 +10,10 @@ Supported types:
## Install ## Install
With pipx
```bash ```bash
pipx install project-manager -i https://git.shmyga.ru/api/packages/InfernalGames/pypi/simple/ --pip-args="--extra-index-url https://pypi.org/simple" pipx install project-manager -i https://git.shmyga.ru/api/packages/InfernalGames/pypi/simple/ --pip-args="--extra-index-url https://pypi.org/simple"
``` ```
With pip
```bash
pip install project-manager --index-url https://git.shmyga.ru/api/packages/InfernalGames/pypi/simple/ --extra-index-url https://pypi.org/simple
```
## Usage ## Usage
### Show tasks list ### Show tasks list
+1 -1
View File
@@ -16,7 +16,7 @@ runs:
cache: "pip" cache: "pip"
- run: | - run: |
pip install --upgrade project-manager \ pip install project-manager \
--index-url https://git.shmyga.ru/api/packages/InfernalGames/pypi/simple/ \ --index-url https://git.shmyga.ru/api/packages/InfernalGames/pypi/simple/ \
--extra-index-url https://pypi.org/simple --extra-index-url https://pypi.org/simple
+1 -11
View File
@@ -1,4 +1,3 @@
import json
import logging import logging
import os import os
import subprocess import subprocess
@@ -44,14 +43,13 @@ class CommandExecutor:
def __init__(self, command: str): def __init__(self, command: str):
self._command = command self._command = command
def run(self, basepath: Path) -> dict | None: def run(self, basepath: Path):
self._logger.debug(self._command) self._logger.debug(self._command)
out_logger = CommandLogger(logging.TRACE) out_logger = CommandLogger(logging.TRACE)
err_logger = CommandLogger(logging.TRACE) err_logger = CommandLogger(logging.TRACE)
try: try:
result = subprocess.run( result = subprocess.run(
self._command, self._command,
executable="bash",
cwd=basepath, cwd=basepath,
stdout=out_logger, # type: ignore stdout=out_logger, # type: ignore
stderr=err_logger, # type: ignore stderr=err_logger, # type: ignore
@@ -60,13 +58,5 @@ class CommandExecutor:
finally: finally:
out_logger.close() out_logger.close()
err_logger.close() err_logger.close()
out_logger.join()
err_logger.join()
if result.returncode != 0: if result.returncode != 0:
raise CommandError("".join(err_logger.lines or out_logger.lines)) raise CommandError("".join(err_logger.lines or out_logger.lines))
if out_logger.lines:
try:
return json.loads(out_logger.lines[0])
except json.JSONDecodeError:
pass
return None
-4
View File
@@ -99,10 +99,6 @@ class PathTemplate:
kk: self._env.from_string(vv).render(**variables) kk: self._env.from_string(vv).render(**variables)
for kk, vv in v.items() for kk, vv in v.items()
} }
elif isinstance(v, list):
variables[k] = [
self._env.from_string(vv).render(**variables) for vv in v
]
else: else:
variables[k] = self._env.from_string(v).render(**variables) variables[k] = self._env.from_string(v).render(**variables)
+1 -1
View File
@@ -70,7 +70,7 @@ class Entry:
@property @property
def sensentive_data(self): def sensentive_data(self):
for k, v in self._variables.items(): for k, v in self._variables.items():
if "pass" in k.lower() and v: if "pass" in k.lower():
yield v yield v
def show(self): def show(self):
+2 -6
View File
@@ -7,15 +7,11 @@ variables.docker_group = "{{ 'DOCKER_GROUP' | env }}"
variables.docker_image = "{% if docker_group | bool %}{{ docker_group }}/{% endif %}{{ docker_name }}" variables.docker_image = "{% if docker_group | bool %}{{ docker_group }}/{% endif %}{{ docker_name }}"
variables.docker_tag = "{{ 'DOCKER_TAG' | env('latest') }}" variables.docker_tag = "{{ 'DOCKER_TAG' | env('latest') }}"
variables.docker_target = "{{ 'DOCKER_TARGET' | env }}" variables.docker_target = "{{ 'DOCKER_TARGET' | env }}"
variables.docker_target_str = "{{ ('--target ' + docker_target) if docker_target else '' }}" variables.docker_target_arg = "{{ ('--target ' + docker_target) if docker_target else '' }}"
variables.docker_build_args = {}
variables.docker_build_args_str = "{% for item in docker_build_args.items() %}--build-arg \"{{ item[0] }}={{ item[1] }}\" {% endfor %}"
# build # build
[presets.docker.tasks.build.default] [presets.docker.tasks.build.default]
commands = [ commands = ["docker build {{ docker_target_arg }} -t {{ docker_image }} . -f Dockerfile"]
"docker build {{ docker_build_args_str }} {{ docker_target_str }} -t {{ docker_image }} . -f Dockerfile",
]
# publish version # publish version
[presets.docker.tasks.publish.version] [presets.docker.tasks.publish.version]
+7 -26
View File
@@ -1,43 +1,24 @@
[presets.gitea] [presets.gitea]
variables.publish_repo = "{{ 'PUBLISH_REPO' | env }}" variables.publish_repo = "{{ 'PUBLISH_REPO' | env }}"
variables.publish_group = "{{ 'PUBLISH_GROUP' | env }}" variables.publish_repo_path = "{{ publish_repo }}/generic/{{ project_name }}/{{ project_version }}"
variables.publish_user = "{{ 'PUBLISH_USER' | env }}"
variables.publish_password = "{{ 'PUBLISH_PASSWORD' | env }}" variables.publish_password = "{{ 'PUBLISH_PASSWORD' | env }}"
variables.publish_auth = "{{ publish_user }}:{{ publish_password }}"
variables.publish_artefacts = {} variables.publish_artefacts = {}
variables.publish_auth_header = "-H 'Authorization: token {{ publish_password }}'"
variables.publish_api_url = "https://{{ publish_repo }}/api"
variables.publish_packages_url = "{{ publish_api_url }}/packages/{{ publish_group }}"
variables.publish_generic_url = "{{ publish_packages_url }}/generic/{{ project_name }}/{{ project_version }}"
variables.publish_releases_url = "{{ publish_api_url }}/v1/repos/{{ publish_group }}/{{ project_name }}/releases"
variables.publish_release_tag_url = "{{ publish_releases_url }}/tags/{{ project_version }}"
[presets.gitea.tasks.publish."{{ publish_artefacts | tojson }}"] [presets.gitea.tasks.publish."{{ publish_artefacts | tojson }}"]
conditions = ["{{ item | file }}"] conditions = ["{{ item | file }}"]
variables.artefact_file = "{{ item }}" variables.artefact_file = "{{ item }}"
variables.artefact_name = "{{ (artefact_file | file).name }}" variables.artefact_name = "{{ (artefact_file | file).name }}"
commands = [ commands = [
"curl -s {{ publish_auth_header }} -X DELETE '{{ publish_generic_url }}/{{ artefact_name }}'", "curl --user \"{{ publish_auth }}\" -X DELETE \"{{ publish_repo_path }}/{{ artefact_name }}\"",
"curl -s {{ publish_auth_header }} --fail-with-body --upload-file '{{ artefact_file }}' '{{ publish_generic_url }}/{{ artefact_name }}'", "curl --user \"{{ publish_auth }}\" --fail --upload-file \"{{ artefact_file }}\" \"{{ publish_repo_path }}/{{ artefact_name }}\"",
] ]
[presets.gitea.tasks.publish.debian_repo] [presets.gitea.tasks.publish.debian_repo]
conditions = ["{{ publish_artefacts.debian | file }}"] conditions = ["{{ publish_artefacts.debian | file }}"]
variables.artefact_file = "{{ publish_artefacts.debian }}" variables.artefact_file = "{{ publish_artefacts.debian }}"
commands = [ commands = [
"curl -s {{ publish_auth_header }} -X DELETE '{{ publish_packages_url }}/debian/pool/noble/main/{{ project_name }}/{{ project_version }}/all'", "curl --user \"{{ publish_auth }}\" -X DELETE \"{{ publish_repo }}/debian/pool/noble/main/{{ project_name }}/{{ project_version }}/all\"",
"curl -s {{ publish_auth_header }} --fail-with-body --upload-file '{{ artefact_file }}' '{{ publish_packages_url }}/debian/pool/noble/main/upload'", "curl --user \"{{ publish_auth }}\" --fail --upload-file \"{{ artefact_file }}\" \"{{ publish_repo }}/debian/pool/noble/main/upload\"",
]
[presets.gitea.tasks.release.create]
conditions = ["{{ publish_repo }}"]
commands = [
"curl -s {{ publish_auth_header }} -X DELETE '{{ publish_release_tag_url }}'",
"curl -s {{ publish_auth_header }} --fail-with-body -X POST '{{ publish_releases_url }}' -H 'Content-Type: application/json' --data '{ \"name\": \"{{ project_version }}\", \"tag_name\": \"{{ project_version }}\" }'",
]
[presets.gitea.tasks.release."{{ publish_artefacts | tojson }}"]
conditions = ["{{ item | file }}"]
variables.artefact_file = "{{ item }}"
commands = [
"(export RELEASE_ID=$(curl -s {{ publish_auth_header }} --fail {{ publish_release_tag_url }} | jq '.id') && curl -s {{ publish_auth_header }} --fail-with-body -X POST \"{{ publish_releases_url }}/$RELEASE_ID/assets\" -H 'Content-Type: multipart/form-data' -F 'attachment=@{{ artefact_file }}')",
] ]
@@ -4,5 +4,4 @@ conditions = ["{{ true }}"]
variables.project_name = "{{ 'pyproject.toml' | read | get('project.name') or 'package.json' | read | get('name') }}" variables.project_name = "{{ 'pyproject.toml' | read | get('project.name') or 'package.json' | read | get('name') }}"
variables.project_version = "{{ 'pyproject.toml' | read | get('project.version') or 'package.json' | read | get('version') }}" variables.project_version = "{{ 'pyproject.toml' | read | get('project.version') or 'package.json' | read | get('version') }}"
variables.version = "{{ 'version' | env }}" variables.version = "{{ 'version' | env }}"
variables.home = "{{ 'home' | env }}"
tasks = {} tasks = {}
-24
View File
@@ -1,24 +0,0 @@
[presets.haxe]
variables.haxe_version_default = "{{ 'package.json' | read | get('haxe') }}"
variables.haxe_version = "{{ 'HAXE_VERSION' | env(haxe_version_default) }}"
variables.neko_version_default = "{{ 'package.json' | read | get('neko') or '2.2.0' }}"
variables.neko_version = "{{ 'NEKO_VERSION' | env(neko_version_default) }}"
variables.neko_sdk = "{{ 'NEKO_SDK' | env(home + '/sdk/neko/' + neko_version) }}"
variables.haxe_sdk = "{{ 'HAXE_SDK' | env(home + '/sdk/haxe/' + haxe_version) }}"
variables.haxe_activate = ". {{ neko_sdk }}/activate && . {{ haxe_sdk }}/activate &&"
variables.haxe_sources = []
variables.haxe_sources_str = "{% for item in haxe_sources %}-s \"{{ item }}\" {% endfor %}"
variables.haxe_formatter = "{{ ((haxe_sdk + '/lib/formatter') | file) and ('./hxformat.json' | file) }}"
conditions = ["{{ haxe_sdk | file }}"]
[presets.haxe.tasks.lint.formatter]
conditions = ["{{ haxe_formatter }}"]
commands = [
"{{ haxe_activate }} haxelib run formatter --check {{ haxe_sources_str or '.' }}",
]
[presets.haxe.tasks.format.formatter]
conditions = ["{{ haxe_formatter }}"]
commands = [
"{{ haxe_activate }} haxelib run formatter {{ haxe_sources_str or '.' }}",
]
+1 -1
View File
@@ -36,4 +36,4 @@ commands = ["rm -rf node_modules"]
# version # version
[presets.nodejs.tasks.version.npm] [presets.nodejs.tasks.version.npm]
conditions = ["{{ version }}"] conditions = ["{{ version }}"]
commands = ["{{ nvm }}npm version {{ version }} --allow-same-version --commit-hooks false --git-tag-version false"] commands = ["{{ nvm }}npm version {{ version }} --allow-same-version"]
+2 -2
View File
@@ -1,13 +1,13 @@
import logging import logging
import sys import sys
from argparse import ArgumentParser from argparse import ArgumentParser
from importlib.metadata import version
from pathlib import Path from pathlib import Path
from typing import Self from typing import Self
from .common.logging_colored import ColoredFormatter from .common.logging_colored import ColoredFormatter
from .entry.entry import PartialTaskKey from .entry.entry import PartialTaskKey
from .manager import ProjectManager from .manager import ProjectManager
from .version import __version__
class ProjectManagerRunner: class ProjectManagerRunner:
@@ -64,7 +64,7 @@ class ProjectManagerRunner:
parser.add_argument("--version", action="store_true") parser.add_argument("--version", action="store_true")
args = parser.parse_args() args = parser.parse_args()
if args.version: if args.version:
print(version("project-manager")) print(__version__)
sys.exit(0) sys.exit(0)
verbose = -1 if args.quiet else args.verbose verbose = -1 if args.quiet else args.verbose
task_key = PartialTaskKey.from_str(args.task) task_key = PartialTaskKey.from_str(args.task)
+6
View File
@@ -0,0 +1,6 @@
import tomllib
from pathlib import Path
__version__ = tomllib.loads(
(Path(__file__).parent.parent / "pyproject.toml").read_text()
)["project"]["version"]
+1 -1
View File
@@ -1,7 +1,7 @@
[project] [project]
name = "project-manager" name = "project-manager"
description = "" description = ""
version = "0.5.0" version = "0.4.1"
readme = "README.md" readme = "README.md"
authors = [{ name = "shmyga", email = "shmyga.z@gmail.com" }] authors = [{ name = "shmyga", email = "shmyga.z@gmail.com" }]
requires-python = ">=3.14,<4.0" requires-python = ">=3.14,<4.0"