Metadata-Version: 2.4
Name: finaira-release
Version: 0.2.0
Summary: Release tooling for trunk-based repositories: RC and final tags, Azure DevOps deploys, release branches and hotfixes. The repositories come from a .env.
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# finaira-release

Release tooling for a trunk-based repository (GitHub as the source, Azure DevOps as the deploy target): RC and final tags, deploys to the Azure DevOps
`dev` and `prod` branches, release branches, fixes, hotfixes and ports. It packages two bash scripts behind one
command, `fin-release`. The package contains no URLs, hosts or credentials: the repositories come from your `.env`, so it works for any repo set up this way.

## Install

```bash
pip install finaira-release
```

Needs WSL (or Linux), `bash`, `git`, `curl` and GNU `sort -V`, plus the VPN if your Azure DevOps needs one.
Windows PowerShell is not supported.

## Settings

Create a `.env` (never commit it, `chmod 600 .env`) in your repository clone or in any parent folder of where you run
the command. `fin-release` uses the nearest `.env` going up from the current folder. Variables already set in the shell win.

```
GITHUB_REPO=https://github.com/<org>/<repo>.git
AZDO_HOST_PATH=dev.azure.com/<org>/<project>/_git/<repo>
AZDO_USERNAME=your-azdo-username-or-email
AZDO_PASSWORD=your-personal-access-token
AZDO_DEV_BRANCH=dev
AZDO_PROD_BRANCH=prod
MIRROR_DEFAULT_BRANCH=main
```

`GITHUB_REPO` can be an SSH or an HTTPS URL, whichever your machine can reach without a prompt. `AZDO_PASSWORD` is your own PAT
with push permission on `dev` and `prod`. A missing variable stops the command and names it. `MIRROR_DEFAULT_BRANCH`, `AZDO_DEV_BRANCH` and `AZDO_PROD_BRANCH` are optional. `MIRROR_DEFAULT_BRANCH` is the GitHub branch `mirror` copies when you name none (default `main`); the other two name the Azure branches that deploy to Dev and Prod (defaults `dev` and `prod`). Put values on their own line, without trailing comments. The two branches must differ; `deploy-dev` and `deploy-prod` write only to them, and `mirror` refuses to write to them.

## Use

```bash
fin-release check                         # settings, PAT, VPN, tools, signing
fin-release status
fin-release deploy-dev --new-rc           # cut the next RC and deploy it to Dev
fin-release deploy-prod --promote         # final tag on the latest RC, deploy to Prod
fin-release branch 1.5.0                  # release branches and fixes
fin-release fix PROJ-123 handle-null --release 1.4.0
fin-release --dry-run deploy-prod --promote
fin-release sync --help                   # full usage of deploys and tags
fin-release release --help                # full usage of branches and fixes
```

The arguments are exactly those of `sync-branch.sh` and `release.sh` in your release runbook.
Everything runs on remote refs in a temporary repository, so your clone and uncommitted work are never touched.

## Mirror

`mirror` copies GitHub branches to Azure DevOps without deploying anything. It never deletes branches on Azure and never
writes to the deploy branches.

```bash
fin-release mirror                       # MIRROR_DEFAULT_BRANCH from .env, else main
fin-release mirror release/1.4.0         # a named branch
fin-release mirror main --as legacy      # GitHub main becomes Azure legacy
fin-release mirror --all                 # every GitHub branch under its own name
fin-release --dry-run mirror --all       # read the plan first
```

`--all` cannot be combined with a branch or `--as`, and it skips GitHub branches named like the Azure deploy branches.
Each branch is fast-forwarded, created, or, if Azure has commits GitHub lacks, reconciled with a merge commit that takes GitHub's files.
You confirm once for the whole run.
