Metadata-Version: 2.4
Name: gitlab-flow
Version: 0.1.2
Summary: A custom GitLab workflow helper package.
Author: id-ego
Requires-Python: >=3.11
Requires-Dist: python-gitlab>=6.0.0
Description-Content-Type: text/markdown

# gitlab-flow

Custom GitLab workflow helper package built with `uv`.

## Local development

```bash
uv sync
uv run gitlab-flow --help
uv run pytest
uv build
```

Build artifacts are created under `dist/`.

## Onboard a GitLab identity

`gitlab-flow onboard` creates a GitLab user, registers an Ed25519 SSH key,
issues an impersonation PAT, and prints the credentials as JSON.

```bash
GITLAB_URL=https://gitlab.example.com \
GITLAB_TOKEN=glpat-admin-token \
GITLAB_SSH_HOST=git.example.com \
GITLAB_EMAIL_DOMAIN=example.com \
uv run gitlab-flow onboard doc-fixer
```

Optional environment variables:

```text
GITLAB_SSH_PORT=22
GITLAB_PAT_EXPIRES_AT=2099-12-31
```

If `GITLAB_PAT_EXPIRES_AT` is not set, `gitlab-flow` asks GitLab to create a
non-expiring token. If the instance requires token expiration dates, the command
fails with an explicit error instead of silently choosing a fallback date.

The JSON includes `pat.token`, `ssh.private_key`, and `ssh.public_key`.
Progress and errors are written to stderr.

## Publish to GitLab Package Registry

The included `.gitlab-ci.yml` publishes the package when a Git tag is pushed.

```bash
git tag v0.1.0
git push origin v0.1.0
```

GitLab CI publishes to:

```text
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi
```

using:

```bash
uv publish \
  --publish-url "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi" \
  --username gitlab-ci-token \
  --password "${CI_JOB_TOKEN}" \
  dist/*
```

## Install from GitLab

Replace `<project-id>` and `<token>` with your GitLab project ID and a token
that can read the package registry.

```bash
uv add gitlab-flow \
  --index-url "https://__token__:<token>@<gitlab-host>/api/v4/projects/<project-id>/packages/pypi/simple"
```
