# Publishing a New Version of `jl-automation-common-modules`

> For how to consume this package in an automation repo, see [USAGE.md](USAGE.md).

---

## Step 1 — Make Your Changes

Edit the relevant file(s) inside `src/joblogic_automation_modules/`.

---

## Step 2 — Bump the Version

Update the version in **two places**:

**`pyproject.toml`**
```toml
version = "1.0.1"
```

**`src/joblogic_automation_modules/__init__.py`**
```python
__version__ = "1.0.1"
```

**Which number to bump?**

| Type of change | What to bump | Example |
|---|---|---|
| Bug fix | PATCH | `1.0.0 → 1.0.1` |
| New feature (no breaking change) | MINOR | `1.0.0 → 1.1.0` |
| Breaking change | MAJOR | `1.0.0 → 2.0.0` |

---

## Step 3 — Commit, Tag, and Push

```bash
git add pyproject.toml src/joblogic_automation_modules/__init__.py
git commit -m "chore: bump version to 1.0.1"
git tag v1.0.1
git push origin main --tags
```

Pushing the tag triggers the Azure Pipeline, which builds the wheel and **automatically publishes to PyPI**. No manual publish step is needed.

---

## Step 4 — Verify

Confirm the tag is visible on the repo:

```bash
git tag -l
```

Or check **Azure DevOps → JobLogic Automations → joblogic-automation-modules → Tags**.

Once the pipeline completes, the package will also be published automatically to PyPI at:
`https://pypi.org/project/jl-automation-common-modules/`

---

## Step 5 — Update Consuming Repos

In each automation repo that needs the new version, update the tag at the end of the Git URL in `requirements.txt`:

**Option A — Install from PyPI (recommended):**

Update the version in `requirements.txt`:

```txt
jl-automation-common-modules==1.0.1
```

**Option B — Install from Git (internal / no PyPI access):**

```txt
# Before
jl-automation-common-modules @ git+https://JobLogic@dev.azure.com/JobLogic/JobLogic%20Automations/_git/joblogic-automation-modules@v1.0.0

# After
jl-automation-common-modules @ git+https://JobLogic@dev.azure.com/JobLogic/JobLogic%20Automations/_git/joblogic-automation-modules@v1.0.1
```

Then reinstall and redeploy the Azure Function as normal.

### Is it safe to leave old automations on the previous version?

Yes. Old automations pinned to `@v1.0.0` continue to install and run exactly as before — Git tags are immutable. They will not receive any updates until you explicitly change the tag.
