Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 2 additions & 66 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- develop
workflow_dispatch:

permissions:
Expand All @@ -21,24 +20,13 @@ jobs:
needs: test-suite
if: needs.test-suite.outputs.tests_passed == 'true'
outputs:
releases_created: ${{ steps.release-develop.outputs.releases_created || steps.release-main.outputs.releases_created }}
paths_released: ${{ steps.release-develop.outputs.paths_released || steps.release-main.outputs.paths_released }}
releases_created: ${{ steps.release-main.outputs.releases_created }}
paths_released: ${{ steps.release-main.outputs.paths_released }}
steps:
- uses: actions/checkout@v7

# Release-please for develop branch (creates alpha prereleases)
- uses: googleapis/release-please-action@v5
if: github.ref == 'refs/heads/develop'
id: release-develop
with:
config-file: .release-please-config-develop.json
manifest-file: .release-please-manifest-develop.json
target-branch: develop
token: ${{ secrets.GITHUB_TOKEN }}

# Release-please for main branch (creates stable releases)
- uses: googleapis/release-please-action@v5
if: github.ref == 'refs/heads/main'
id: release-main
with:
config-file: .release-please-config.json
Expand Down Expand Up @@ -73,58 +61,6 @@ jobs:
run: |
uv run python -c 'import otdf_python; print("Package imported successfully")'

# While we improve the release process, prevent publishing to TestPyPI for versions <= 0.3.2
- name: Store version and determine if should publish to TestPyPI
id: check_version
shell: bash
run: |
PROJECT_VERSION=$(uv version --package otdf-python --short)
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV

if [[ "$PROJECT_VERSION" =~ [0-9]+\.[0-9]+\.[0-9]+a[0-9]+ ]]; then
echo "is_alpha=true" >> $GITHUB_OUTPUT
echo "Alpha version detected: $PROJECT_VERSION"
else
echo "is_alpha=false" >> $GITHUB_OUTPUT
echo "Stable version detected: $PROJECT_VERSION"
fi

# Remove any alpha/beta/rc suffixes for comparison
CLEAN_VERSION=$(echo "$PROJECT_VERSION" | sed 's/[a-zA-Z].*//')
echo "clean_version=$CLEAN_VERSION" >> $GITHUB_OUTPUT

# Convert versions to comparable format (e.g., "0.3.2" -> "000300020000")
version_to_number() {
echo "$1" | awk -F. '{ printf("%04d%04d%04d\n", $1,$2,$3); }'
}

CURRENT_NUM=$(version_to_number "$CLEAN_VERSION")
THRESHOLD_NUM=$(version_to_number "0.3.2")

if [ "$CURRENT_NUM" -gt "$THRESHOLD_NUM" ]; then
echo "should_publish=true" >> $GITHUB_OUTPUT
echo "Version $PROJECT_VERSION (clean: $CLEAN_VERSION) is > 0.3.2, will publish to TestPyPI"
else
echo "should_publish=false" >> $GITHUB_OUTPUT
echo "Version $PROJECT_VERSION (clean: $CLEAN_VERSION) is <= 0.3.2, skipping TestPyPI publish"
fi

# For develop branch: trigger TestPyPI build (alpha prereleases go to TestPyPI from develop)

# Publish with "trusted publisher" mechanism:
# https://docs.pypi.org/trusted-publishers/
#
# Requires GHA token permission (above in YAML) and PyPI management:
# https://test.pypi.org/manage/project/otdf-python/settings/publishing/
- name: Publish package distributions to TestPyPI
if: github.ref == 'refs/heads/develop' && steps.check_version.outputs.should_publish == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
packages-dir: dist/

# For main branch: trigger PyPI build (stable releases go to PyPI from main)
# Publish with "trusted publisher" mechanism:
# https://docs.pypi.org/trusted-publishers/
#
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- develop
pull_request:
workflow_call:
outputs:
Expand Down
44 changes: 0 additions & 44 deletions .release-please-config-develop.json

This file was deleted.

3 changes: 0 additions & 3 deletions .release-please-manifest-develop.json

This file was deleted.

124 changes: 21 additions & 103 deletions docs/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,11 @@ This document describes the automated release process for the OpenTDF Python SDK

## Overview

The OpenTDF Python SDK uses a **dual-branch release strategy** with automated publishing:
The OpenTDF Python SDK publishes stable releases from the `main` branch:

- **`develop` branch**: Creates alpha prereleases (e.g., `v1.0.0-alpha.1`) → Published to TestPyPI
- **`main` branch**: Creates stable releases (e.g., `v1.0.0`) → Published to PyPI

This ensures that alpha and stable releases have distinct version numbers and publishing destinations, preventing conflicts between development and production releases.

## Branch Strategy

### Develop Branch (Alpha Releases)
- **Purpose**: Development and testing
- **Release Type**: Alpha prereleases (`v1.0.0-alpha.1`, `v1.0.0-alpha.2`, etc.)
- **GitHub Status**: Marked as "pre-release"
- **Publishing Target**: TestPyPI (test.pypi.org)
- **Trigger**: Push to `develop` branch with conventional commits

### Main Branch (Stable Releases)
- **Purpose**: Production releases
- **Release Type**: Stable releases (`v1.0.0`, `v1.0.1`, etc.)
- **GitHub Status**: Marked as stable release
- **Publishing Target**: PyPI (pypi.org)
- **Trigger**: Push to `main` branch with conventional commits
There is currently no `develop` branch and no alpha/prerelease channel. All releases are stable releases published to PyPI.

## Automated Release Process

Expand All @@ -36,79 +19,37 @@ This ensures that alpha and stable releases have distinct version numbers and pu
- Integration tests
- Code quality checks (linting, formatting)

### For Alpha Releases (Develop Branch)
### Creating a Stable Release

1. **Commit with Conventional Commit Messages** to `develop` branch:
1. **Commit with Conventional Commit Messages** to `main`:
```bash
git checkout develop
git checkout main
git commit -m "feat: add new encryption algorithm support"
git commit -m "fix: resolve TDF decryption issue with large files"
git push origin develop
```

2. **Automated Process**:
- Release Please creates a PR with alpha version bump and changelog
- Once PR is merged, GitHub Actions automatically:
- Runs full test suite
- Builds the package
- Creates GitHub release marked as "pre-release"
- Publishes to TestPyPI (if version > 0.3.2)

**Note**: The develop branch uses separate configuration files (`.release-please-config-develop.json` and `.release-please-manifest-develop.json`) to ensure proper alpha version tracking independent of the main branch.

### For Stable Releases (Main Branch)

1. **Merge from develop** (or commit directly):
```bash
git checkout main
git merge develop
# OR make direct commits with conventional commit messages
git commit -m "feat: stable feature ready for production"
git push origin main
```

2. **Automated Process**:
- Release Please creates a PR with stable version bump and changelog
- Once PR is merged, GitHub Actions automatically:
- Runs full test suite
- Release Please creates a PR with a version bump and changelog
- Once the PR is merged, GitHub Actions automatically:
- Runs the full test suite
- Builds the package
- Creates GitHub release marked as stable
- Creates a GitHub release
- Publishes to PyPI

## Version Numbering

### How Version Tracking Works

Release Please uses manifest files to track the "last released version" for each branch:

- **`.release-please-manifest.json`**: Tracks the last stable release from main branch
- **`.release-please-manifest-develop.json`**: Tracks the last alpha release from develop branch

When Release Please runs, it:
Release Please uses `.release-please-manifest.json` to track the last released version. When it runs, it:
1. Reads the manifest to find the last released version
2. Analyzes conventional commits since that version
3. Calculates the next version based on commit types (feat, fix, etc.)
4. For develop branch: Applies alpha suffix due to prerelease configuration

### Alpha Versions (from develop)
- Format: `vX.Y.Z-alpha.N` (e.g., `v0.3.1-alpha.1`, `v0.3.1-alpha.2`)
- Automatically incremented by Release Please using separate configuration files
- Marked as pre-release on GitHub
- Published to TestPyPI
- Tracked independently from main branch versions

### Stable Versions (from main)
- Format: `vX.Y.Z` (e.g., `v0.3.1`, `v0.3.2`)
- Follow semantic versioning
- Marked as stable release on GitHub
- Published to PyPI
- Use main branch configuration files
3. Calculates the next version based on commit types (`feat`, `fix`, etc.)

Stable versions follow semantic versioning (e.g., `v0.10.0`, `v0.10.1`) and are published to PyPI (pypi.org).

## Manual Release Triggers

You can manually trigger releases via GitHub Actions:
You can manually trigger a release via GitHub Actions:
- Go to **Actions** → **"Release Please"** → **"Run workflow"**
- Select the appropriate branch (`develop` for alpha, `main` for stable)

## Conventional Commit Messages

Expand All @@ -126,24 +67,14 @@ git commit -m "fix: resolve memory leak in encryption" # Patch bump
git commit -m "feat!: redesign SDK API (BREAKING CHANGE)" # Major bump
```

## Testing Process

### Testing Alpha Releases
```bash
# Install from TestPyPI (alpha versions use the format X.Y.Z-alphaX)
pip install --index-url https://test.pypi.org/simple/ otdf-python==0.3.1a1

# Test functionality
python -c "import otdf_python; print('Alpha version works!')"
```
## Testing a Release

### Testing Stable Releases
```bash
# Install from PyPI
pip install otdf-python==0.3.1
pip install otdf-python==0.10.0

# Test functionality
python -c "import otdf_python; print('Stable version works!')"
python -c "import otdf_python; print('Release works!')"
```

## Multi-Package Releases
Expand All @@ -159,23 +90,12 @@ Release Please automatically updates version references in both packages using t
### No Release Created
- Verify commits use conventional commit format
- Check that tests pass in GitHub Actions
- Ensure commits were pushed to the correct branch
- Ensure commits were pushed to `main`

### Failed Publishing
- Check GitHub Actions logs for detailed error messages
- Verify PyPI trusted publisher configuration
- Ensure version doesn't already exist on the target repository

### Release Please Configuration Errors
- **Error: "Missing required manifest versions"**: Ensure both `.release-please-config-develop.json` and `.release-please-manifest-develop.json` are committed to the repository
- **Dynamic file creation errors**: The develop-specific configuration files must exist in the repository, not generated at runtime
- **Wrong branch configuration**: Verify the workflow uses the correct config and manifest files for each branch

### Version Conflicts
- Alpha and stable releases use separate configuration and manifest files to prevent conflicts
- Develop branch uses `.release-please-config-develop.json` and `.release-please-manifest-develop.json`
- Main branch uses `.release-please-config.json` and `.release-please-manifest.json`
- If conflicts occur, check the appropriate Release Please configuration files for the target branch
- Ensure the version doesn't already exist on PyPI

## Emergency Procedures

Expand All @@ -190,10 +110,8 @@ git push origin main

## Configuration Files

- `.release-please-config.json`: Main branch release configuration (stable releases)
- `.release-please-manifest.json`: Main branch version tracking
- `.release-please-config-develop.json`: Develop branch release configuration (alpha releases)
- `.release-please-manifest-develop.json`: Develop branch version tracking
- `.release-please-config.json`: Release configuration
- `.release-please-manifest.json`: Version tracking
- `.github/workflows/release-please.yaml`: GitHub Actions workflow

## Support
Expand Down
Loading