Skip to content

Commit eee083b

Browse files
committed
🔖 version 0.1.0
1 parent 900b1ae commit eee083b

File tree

7 files changed

+140
-20
lines changed

7 files changed

+140
-20
lines changed

.github/workflows/docker.yml

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ jobs:
5353
env:
5454
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5555

56-
5756
build:
5857
runs-on: ubuntu-latest
5958
needs: metadata
@@ -75,9 +74,7 @@ jobs:
7574
python_variant:
7675
- ""
7776
- "-slim"
78-
platform:
79-
- linux/amd64
80-
- linux/arm64
77+
platform: ${{ fromJSON(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && '["linux/arm64","linux/amd64"]' || '["linux/amd64"]') }}
8178
steps:
8279
- name: Checkout (Latest Release)
8380
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
@@ -116,6 +113,10 @@ jobs:
116113
id: metadata
117114
with:
118115
images: ${{ steps.image.outputs.IMAGE }}
116+
tags: |
117+
type=edge,value=nightly
118+
type=ref,event=pr
119+
type=sha,event=branch
119120
120121
- name: Build and Publish
121122
uses: docker/build-push-action@v6
@@ -199,23 +200,36 @@ jobs:
199200
run: |
200201
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}" >> $GITHUB_OUTPUT
201202
202-
- name: Generate Tags
203+
- name: Generate Tags (Release)
203204
uses: docker/metadata-action@v5
204-
id: metadata
205+
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
206+
id: metadata-release
205207
with:
206208
context: git
207209
images: |
208210
${{ steps.image.outputs.IMAGE }}
209211
flavor: |
210212
suffix=-py${{ matrix.python_version }}${{ matrix.python_variant }},onlatest=true
211213
tags: |
212-
type=edge,value=nightly
213-
type=ref,event=pr
214-
type=sha,event=branch
215214
type=semver,pattern={{version}}
216215
type=semver,pattern={{major}}.{{minor}}
217216
type=semver,pattern={{major}}
218217
218+
- name: Generate Labels (Other)
219+
if: github.event_name != 'workflow_run'
220+
uses: docker/metadata-action@v5
221+
id: metadata-other
222+
with:
223+
context: git
224+
images: |
225+
${{ steps.image.outputs.IMAGE }}
226+
flavor: |
227+
suffix=-py${{ matrix.python_version }}${{ matrix.python_variant }},onlatest=true
228+
tags: |
229+
type=edge,value=nightly
230+
type=ref,event=pr
231+
type=sha,event=branch
232+
219233
- name: Create manifest list and push
220234
working-directory: /tmp/digests
221235
run: |
@@ -224,10 +238,10 @@ jobs:
224238
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
225239
$(printf '${{ steps.image.outputs.IMAGE }}@sha256:%s ' *)
226240
227-
- name: Generate Tags
241+
- name: Generate Tags (Release)
228242
uses: docker/metadata-action@v5
229-
id: metadata-latest
230-
if: matrix.python_version == env.LATEST_PYTHON_VERSION
243+
id: metadata-latest-release
244+
if: matrix.python_version == env.LATEST_PYTHON_VERSION && github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
231245
with:
232246
context: git
233247
images: |
@@ -238,7 +252,19 @@ jobs:
238252
type=semver,pattern={{version}}
239253
type=semver,pattern={{major}}.{{minor}}
240254
type=semver,pattern={{major}}
241-
255+
- name: Generate Labels (Other)
256+
if: matrix.python_version == env.LATEST_PYTHON_VERSION && github.event_name != 'workflow_run'
257+
uses: docker/metadata-action@v5
258+
id: metadata-latest-other
259+
with:
260+
context: git
261+
images: |
262+
${{ steps.image.outputs.IMAGE }}
263+
flavor: |
264+
suffix=${{ matrix.python_variant }},onlatest=true
265+
tags: |
266+
type=ref,event=pr
267+
type=sha,event=branch
242268
- name: Create manifest list and push for latest python version
243269
if: matrix.python_version == env.LATEST_PYTHON_VERSION
244270
working-directory: /tmp/digests

README.md

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,77 @@
1-
# entari-cli
2-
Entari Command Line Tool, extract from arclet.entari.\_\_main__
1+
<div align="center">
2+
3+
# Entari CLI
4+
5+
_✨ Entari 命令行工具 ✨_
6+
7+
</div>
8+
9+
<p align="center">
10+
<a href="https://raw.githubusercontent.com/ArcletProject/entari-cli/main/LICENSE">
11+
<img src="https://img.shields.io/github/license/ArcletProject/entari-cli" alt="license">
12+
</a>
13+
<a href="https://pypi.python.org/pypi/entari-cli">
14+
<img src="https://img.shields.io/pypi/v/entari-cli" alt="pypi">
15+
</a>
16+
<img src="https://img.shields.io/badge/python-3.9+-blue" alt="python">
17+
</p>
18+
19+
<p align="center">
20+
<a href="https://arclet.top/tutorial/entari">Entari 文档</a>
21+
</p>
22+
23+
## 功能
24+
25+
- 初始化 Entari 环境
26+
- 启动 Entari
27+
- 生成配置文件
28+
- 管理插件
29+
- 创建新的 Entari 插件 (项目型/应用型)
30+
- 支持 CLI 插件
31+
32+
## 安装
33+
34+
使用 pipx 安装
35+
36+
```shell
37+
pipx install entari-cli
38+
```
39+
40+
使用 Docker 运行
41+
42+
```shell
43+
docker pull ghcr.io/arcletproject/entari-cli:latest
44+
```
45+
46+
Docker 镜像可以选择以下版本:
47+
48+
- `latest`, `latest-slim`:最新的稳定版本
49+
- `latest-${python版本}`, `latest-${python版本}-slim`:指定 Python 版本的最新稳定版本
50+
- `${cli版本}`, `${cli版本}-slim`:指定 CLI 版本的最新稳定版本
51+
- `${cli版本}-${python版本}`, `${cli版本}-${python版本}-slim`:指定 CLI 和 Python 版本的最新稳定版本
52+
53+
## 命令行使用
54+
55+
```shell
56+
entari --help
57+
```
58+
59+
> **Warning**
60+
>
61+
> 如果找不到 `entari` 命令,请尝试 `pipx ensurepath` 来添加路径到环境变量
62+
63+
- `entari add` 添加一个 Entari 插件到配置文件中
64+
- `entari config` 配置文件操作
65+
- `entari gen_main` 生成一个 Entari 主程序文件
66+
- `entari init` 新建一个虚拟环境并安装 Entari
67+
- `entari new` 新建一个 Entari 插件
68+
- `entari remove` 从配置文件中移除一个 Entari 插件
69+
- `entari run` 运行 Entari
70+
71+
## Docker 镜像使用
72+
73+
```shell
74+
docker run --rm -it -v ./:/workspaces ghcr.io/arcletproject/entari-cli:latest --help
75+
```
76+
77+
挂载当前目录到容器的 `/workspaces` 目录,然后在容器中运行 `entari` 命令。

pyproject.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ dependencies = ["cli-lite>=0.11.0", "colorama>=0.4.6", "tomlkit>=0.13.3", "ruame
99
requires-python = ">=3.9"
1010
readme = "README.md"
1111
license = {text = "MIT"}
12+
keywords = ["bot", "dependency", "entari"]
13+
classifiers = [
14+
"Development Status :: 4 - Beta",
15+
"Topic :: Software Development :: Build Tools",
16+
"Framework :: Robot Framework",
17+
"Framework :: Robot Framework :: Library",
18+
"License :: OSI Approved :: MIT License",
19+
"Operating System :: OS Independent",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
25+
"Programming Language :: Python :: 3.13",
26+
]
1227

1328
[project.optional-dependencies]
1429
virtualenv = [
@@ -30,6 +45,9 @@ distribution = true
3045
source = "file"
3146
path = "src/entari_cli/__init__.py"
3247

48+
[tool.pdm.build]
49+
include = ["src/"]
50+
3351
[dependency-groups]
3452
dev = [
3553
"isort==5.13.2",

src/entari_cli/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,3 @@
2222

2323
for _, name, _ in pkgutil.iter_modules(COMMANDS_MODULE_PATH):
2424
importlib.import_module(f"entari_cli.commands.{name}", __name__)
25-
26-
cli.load_register("entari_cli.plugins")

src/entari_cli/__main__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
def main():
22
from entari_cli import cli
33

4+
cli.load_entry()
5+
cli.load_register("entari_cli.plugins")
46
cli.main()
57

68

src/entari_cli/commands/new.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ def dispatch(self, result: Arparma, next_: Next):
146146
f.write(
147147
PLUGIN_PROJECT_TEMPLATE.format(
148148
name=proj_name,
149-
version=entari_version,
149+
version=version,
150150
description=description,
151151
author=f'{{"name" = "{author}", "email" = "{email}"}}',
152-
entari_version="0.15.0",
152+
entari_version=entari_version,
153153
python_requirement=f'"{python_requires}"',
154154
license=f'{{"text" = "{licence}"}}',
155155
)

src/entari_cli/project.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def version_matcher(py_version: PythonInfo) -> bool:
7373
def ensure_python(cwd: Path, python: str = "") -> PythonInfo:
7474
selected_python = select_python(cwd, python)
7575
if selected_python.get_venv() is None or is_conda_base_python(selected_python.path):
76-
create_virtualenv(cwd / ".venv", str(selected_python.path))
76+
prompt = f"{cwd.name}-{selected_python.major}.{selected_python.minor}"
77+
create_virtualenv(cwd / ".venv", str(selected_python.path), prompt)
7778
selected_python = PythonInfo.from_path(get_venv_python(cwd)[0])
7879
return selected_python

0 commit comments

Comments
 (0)