diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 8d2602a..76e4629 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -46,7 +46,7 @@ jobs: - name: Check tag matches pyproject version run: | - VERSION=$(python3 -c "import tomllib; d=tomllib.load(open('pyproject.toml','rb')); print(d['tool']['poetry']['version'])") + VERSION=$(poetry version --short) TAG="${GITHUB_REF_NAME#v}" echo "pyproject version: $VERSION" diff --git a/.github/workflows/publish-testpypi.yml b/.github/workflows/publish-testpypi.yml index 309fe4a..e0c7c9e 100644 --- a/.github/workflows/publish-testpypi.yml +++ b/.github/workflows/publish-testpypi.yml @@ -47,7 +47,7 @@ jobs: - name: Check tag matches pyproject version run: | - VERSION=$(python3 -c "import tomllib; d=tomllib.load(open('pyproject.toml','rb')); print(d['tool']['poetry']['version'])") + VERSION=$(poetry version --short) TAG="${GITHUB_REF_NAME#v}" echo "pyproject version: $VERSION" diff --git a/docs/developer_guide/release.md b/docs/developer_guide/release.md index 3d6c5c9..0348641 100644 --- a/docs/developer_guide/release.md +++ b/docs/developer_guide/release.md @@ -15,28 +15,33 @@ The document outlines the steps to build and release the `deeptab` package. At t 'edgeLabelBackground': '#f9fafb' }}}%% flowchart TD - A[Create release/vX.Y.Z branch]:::setup --> B[Bump version]:::setup - B --> C[Update CHANGELOG.md]:::setup - C --> D[Commit & push branch]:::setup - D --> E[Open PR: release/vX.Y.Z → main]:::pr - E --> F{Review & approve}:::decision - F --> G[Merge PR into main]:::pr - G --> H[git checkout main && git pull]:::git - H --> I{Release type?}:::decision - I -->|RC| J["git tag vX.Y.ZrcN\ngit push origin vX.Y.ZrcN"]:::git - I -->|Stable| K["git tag vX.Y.Z\ngit push origin vX.Y.Z"]:::git - J --> L[CI: publish-testpypi.yml]:::ci - K --> M[CI: publish-pypi.yml]:::ci - L --> N[TestPyPI + GitHub pre-release]:::rc - M --> O[PyPI + GitHub Release]:::stable - - classDef setup fill:#dbeafe,stroke:#3b82f6,color:#1e3a5f - classDef pr fill:#ede9fe,stroke:#8b5cf6,color:#3b0764 + A[Create release/vX.Y.Z branch]:::setup --> B{Release type?}:::decision + B -->|RC| RC1[Bump version e.g. 1.7.0rc1]:::setup + B -->|Stable| ST1[Bump version e.g. 1.7.0]:::setup + RC1 --> RC2[Update CHANGELOG.md]:::setup + RC2 --> RC3[Commit & push branch]:::setup + RC3 --> RC4["git tag vX.Y.ZrcN
git push origin vX.Y.ZrcN"]:::git + RC4 --> RC5[CI: publish-testpypi.yml]:::ci + RC5 --> RC6[TestPyPI + GitHub pre-release]:::rc + RC6 -->|Issues found| RC1 + RC6 -->|RC approved| ST1 + ST1 --> ST2[Update CHANGELOG.md]:::setup + ST2 --> ST3[Commit & push branch]:::setup + ST3 --> ST4[Open PR: release/vX.Y.Z → main]:::pr + ST4 --> ST5{Review & approve}:::decision + ST5 --> ST6[Merge PR into main]:::pr + ST6 --> ST7[git checkout main && git pull]:::git + ST7 --> ST8["git tag vX.Y.Z
git push origin vX.Y.Z"]:::git + ST8 --> ST9[CI: publish-pypi.yml]:::ci + ST9 --> ST10[PyPI + GitHub Release]:::stable + + classDef setup fill:#dbeafe,stroke:#3b82f6,color:#1e3a5f + classDef pr fill:#ede9fe,stroke:#8b5cf6,color:#3b0764 classDef decision fill:#fef9c3,stroke:#ca8a04,color:#713f12 - classDef git fill:#f0fdf4,stroke:#22c55e,color:#14532d - classDef ci fill:#fff7ed,stroke:#f97316,color:#7c2d12 - classDef rc fill:#fdf4ff,stroke:#d946ef,color:#701a75 - classDef stable fill:#ecfdf5,stroke:#10b981,color:#064e3b + classDef git fill:#f0fdf4,stroke:#22c55e,color:#14532d + classDef ci fill:#fff7ed,stroke:#f97316,color:#7c2d12 + classDef rc fill:#fdf4ff,stroke:#d946ef,color:#701a75 + classDef stable fill:#ecfdf5,stroke:#10b981,color:#064e3b ``` ## 1. Test documentation @@ -86,17 +91,31 @@ git commit -m "bump: version 1.6.1 → 1.7.0rc1" The version number follows the format `major.minor.patch` for stable, or `major.minor.patchrcN` for release candidates. -## 3. Release PR +## 3. Tag and publish a release candidate + +RC tags are pushed **directly from the release branch** — no PR to `main` required. + +```bash +git tag -a vX.Y.ZrcN -m "Release candidate vX.Y.ZrcN" +git push origin vX.Y.ZrcN +``` + +This triggers `publish-testpypi.yml`, which publishes to **TestPyPI** and creates a GitHub pre-release. + +If issues are found, fix them on the release branch, bump to the next RC (`rcN+1`), and repeat. + +## 4. Release PR (stable only) + +Once all RCs are approved, open a PR from `release/vX.Y.Z` to `main`: -- Open a PR from `release/vX.Y.Z` to `main` - After review and approval, merge the PR - **Merging to `main` does NOT trigger a PyPI release** > **Promoting a model from experimental to stable?** Verify the [Model Promotion Policy](model_promotion_policy.md) checklist is complete before merging a release PR that includes a promotion. -## 4. Create and push the Git tag +## 5. Create and push the stable tag -After the release PR is merged, the maintainer creates the release tag: +After the release PR is merged: ```bash git checkout main && git pull @@ -104,19 +123,12 @@ git tag -a vX.Y.Z -m "Release vX.Y.Z" git push origin vX.Y.Z ``` -For a release candidate: - -```bash -git tag -a vX.Y.Zrc1 -m "Release candidate vX.Y.Zrc1" -git push origin vX.Y.Zrc1 -``` - -## 5. Publish package to PyPI +## 6. Publish package to PyPI The tag push automatically triggers the appropriate workflow in GitHub Actions: - Stable tag (`vX.Y.Z`) → `publish-pypi.yml` → publishes to **PyPI** + creates GitHub Release -- RC tag (`vX.Y.Zrc1`) → `publish-testpypi.yml` → publishes to **TestPyPI** + creates GitHub pre-release +- RC tag (`vX.Y.ZrcN`) → `publish-testpypi.yml` → publishes to **TestPyPI** + creates GitHub pre-release Both workflows: @@ -127,6 +139,6 @@ Both workflows: > **Note:** A `pypi-publish` GitHub Environment (for stable) and `testpypi-publish` environment (for RCs) must be configured with tag-based deployment protection rules. -## 6. GitHub Release +## 7. GitHub Release The GitHub Release is created automatically by the publish workflow. Verify the release notes are correct and add any manual context if needed. diff --git a/pyproject.toml b/pyproject.toml index 0e0bce9..18664a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "deeptab" -version = "1.7.0rc1" +version = "1.7.0rc2" description = "A python package for tabular deep learning."