Skip to content

Commit 62961bc

Browse files
cleanup
1 parent 582834e commit 62961bc

File tree

3 files changed

+135
-32
lines changed

3 files changed

+135
-32
lines changed

docs/release-workflow.md

Lines changed: 129 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Release Workflow
2-
updated: 05/16/2025
1+
# Manual and Automated Release Workflows
2+
updated: 06/20/2025
33

4-
This document describes the process for releasing new versions of the heroku-applink-python library.
4+
This document describes the process for releasing new versions of the heroku-applink-python library automatically through Github actions, or manually.
55

66
## Overview
77

8-
The release process is automated through GitHub Actions and consists of three main workflows:
8+
The automated release process is automated through GitHub Actions and consists of three main workflows:
99

10-
1. Package Library (`package.yml`)
11-
2. Create Tag (`create-tag.yml`)
12-
3. Publish Release (`publish.yml`)
10+
1. Test, Lint, and Build (`test-lint-build.yml`)
11+
2. Create Github Tag and Release (`tag-and-release.yml`)
12+
3. Publish to PyPI and Change Management (`publish.yml`)
1313

14-
## Release Process
14+
## Automated Release Process
1515

1616
### 1. Creating a Release Branch
1717

@@ -25,57 +25,66 @@ Run the draft-release script locally:
2525
```
2626

2727
This method will:
28-
- Create a new release branch (e.g., `release-v1.0.0`)
28+
- Create a new release branch (e.g., `release-v$VERSION`)
2929
- Update version in `pyproject.toml`
3030
- Update `CHANGELOG.md` with all changes since the last release
3131
- Create a draft pull request
3232

33+
**Requirements**
34+
- Review all changelog entries
35+
- The commit message for the release branch must include "Merge pull request" and "release-v$VERSION" to trigger the release workflows.
36+
37+
ex.
38+
```
39+
Merge pull request release-v$VERSION
40+
```
41+
3342
### 2. Testing and Building
3443

35-
When a pull request is pushed into main from a branch named "release-*:
44+
When a pull request is pushed into main from a branch named `release-*`, with commit message `Merge pull request release-*`:
3645

37-
1. The Package Library workflow runs automatically and:
46+
1. The Test, Lint, and Build workflow runs automatically and:
3847
- Runs tests across Python 3.10, 3.11, 3.12, and 3.13
3948
- Runs linting with Ruff
4049
- Builds the package
41-
- Uploads the build artifacts from the build
4250

4351
### 3. Creating a Release Tag
4452

45-
After the release branch pull request is merged to main:
53+
After the release branch pull request is merged to main and the Test, Lint, and Build workflow completes successfully:
4654

47-
1. The Create Tag workflow is triggered, and automatically:
55+
1. The Create Github Tag and Release workflow is triggered, and automatically:
4856
- Extracts the version from the release branch name
49-
- Creates a new tag (e.g., `v1.0.0`)
57+
- Creates a new tag (e.g., `v$VERSION`)
5058
- Pushes the tag to the repository
59+
- Creates a Github release
5160

5261
### 4. Publishing the Release
5362

54-
When a new tag is pushed during the create tag workflow:
63+
When the Create Github Tag and Release workflow completes successfully:
5564

5665
1. The Publish Release workflow is triggered, and automatically:
57-
- Checks for deployment moratorium using TPS
58-
- Downloads the build artifacts from the build job
59-
- Creates a GitHub release with the artifacts
66+
- Checks for deployment moratorium using TPS and obtains release lock
67+
- Checks out the new tag and builds the package
6068
- Publishes the package to PyPI
6169
- Records the release in Change Management
6270

6371
## Workflow Files
6472

65-
### package.yml
73+
### test-lint-build.yml
6674
- Triggers on pushes to main and pull requests
6775
- Runs tests and linting
6876
- Builds the package
69-
- Uploads artifacts when merging from release branches
7077

71-
### create-tag.yml
72-
- Triggers on successful completion of Package Library workflow if it is a release branch
78+
### tag-and-release.yml
79+
- Triggers on successful completion of Test, Lint, and Build workflow if it is a release branch and contains the necessary commit message
7380
- Creates and pushes version tags
81+
- Creates a Gihub release
7482

7583
### publish.yml
76-
- Triggers on new version tags pushed to main
84+
- Triggers on successful completion of Create Github Tag and Release
7785
- Handles the actual release process
78-
- Publishes to GitHub, PyPI, and Change Management
86+
- Checks for moratorium and obtains release locks
87+
- Publishes to PyPI, and Change Management
7988

8089
## Requirements
8190

@@ -84,7 +93,9 @@ When a new tag is pushed during the create tag workflow:
8493
- `id-token: write` (for PyPI publishing)
8594
- Environment secrets:
8695
- `TPS_API_TOKEN_PARAM` - stored in token store
87-
- `TPS_API_RELEASE_ACTOR_EMAIL` - [email protected]
96+
- `TPS_API_RELEASE_ACTOR_EMAIL` - [email protected]
97+
- Release Branch Commit Message
98+
- The commit message for the release branch must include "Merge pull request" and "release-v$VERSION" to trigger the release workflows
8899

89100
## Best Practices
90101

@@ -107,4 +118,95 @@ This "fix forward" approach ensures:
107118
- A clear audit trail of changes
108119
- Proper versioning of fixes
109120
- Consistent release history
110-
- No disruption to users who have already upgraded
121+
- No disruption to users who have already upgraded
122+
123+
124+
# Manual Release Workflow
125+
126+
The automated release process is new, and may need some debugging pending more runs in production. In the case you need to release a new version and the release workflow in github actions fails, you can do a manual release.
127+
128+
## Manual Release Process
129+
130+
### 1. Creating a Release Branch
131+
132+
Run the draft-release script locally:
133+
```bash
134+
# For a minor version bump, auto generating the version
135+
./scripts/release/draft-release minor
136+
137+
# You can also bump from a specific previous version
138+
./scripts/release/draft-release patch 1.2.2
139+
```
140+
141+
This method will:
142+
- Create a new release branch (e.g., `release-v$VERSION`)
143+
- Update version in `pyproject.toml`
144+
- Update `CHANGELOG.md` with all changes since the last release
145+
- Create a draft pull request
146+
147+
**Requirements**
148+
- Review all changelog entries
149+
- The commit message for the release branch must include "Merge pull request" and "release-v$VERSION" to trigger the release workflows.
150+
```
151+
Merge pull request release-v$VERSION
152+
```
153+
154+
### 2. Moratorium Check and Obtain Release Lock
155+
Run script manually to check for moratorium and obtain release lock.
156+
157+
```bash
158+
# Get the latest SHA from the most recent commit (ensure this commit is the release branch commit to main)
159+
export SHA="$(git rev-parse origin/main)"
160+
161+
./scripts/release/tps-check-lock heroku-applink-python $SHA
162+
```
163+
164+
**Required environment variables**
165+
TPS_API_TOKEN - This can be found in team password manager
166+
167+
168+
### 3. Pushing the tag to Github
169+
170+
Once the release branch as been merged into main, you will want to push the signed tag to github.
171+
172+
```bash
173+
export VERSION="1.0.0"
174+
175+
git tag -s v$VERSION -m "Release v$VERSION"
176+
```
177+
178+
### 4. Build the package
179+
180+
Check out the latest tag, and then run uv build to build the package. You should see the new version generated in the dist directory.
181+
182+
```bash
183+
git checkout $(git describe --tags --abbrev=0)
184+
185+
uv build
186+
```
187+
188+
### 5. Create the Github Release
189+
190+
```bash
191+
gh release create v$VERSION --generate-notes dist/*.whl dist/*.tar.gz
192+
```
193+
194+
### 6. Publish to PyPI
195+
Publish the package to pypi using __token__ as the username, and the shared team heroku applink manual publishing token as the token.
196+
197+
```bash
198+
uv publish
199+
```
200+
201+
### 7. Publish to Change Management
202+
Run script manually to publish to change management. Ensure you are using '@salesforce' email address.
203+
204+
```bash
205+
export ACTOR_EMAIL="[email protected]"
206+
207+
./scripts/release/tps-record-release heroku-applink-python $SHA $ACTOR_EMAIL
208+
```
209+
210+
**Required environment variables**
211+
212+
TPS_API_TOKEN - This can be found in team password manager

scripts/release/tps-check-lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
set -eu
33
set -o pipefail
44

5-
# Usage: ./scripts/release/tps_check_lock
5+
# Usage: ./scripts/release/tps-check-lock
66
# Required env vars: TPS_API_TOKEN, COMPONENT_SLUG, RELEASE_SHA
77
#
8-
# Alternate Usage: ./scripts/release/tps_check_lock <component-slug> <release-id>
8+
# Alternate Usage: ./scripts/release/tps-check-lock <component-slug> <release-sha>
99
# Required env vars: TPS_API_TOKEN
1010

1111
if [ -z "${TPS_HOSTNAME:-}" ]; then

scripts/release/tps-record-release

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
set -eu
33
set -o pipefail
44

5-
# Usage: ./scripts/release/tps_record_release
5+
# Usage: ./scripts/release/tps-record-release
66
# Required env vars: TPS_API_TOKEN, COMPONENT_SLUG, RELEASE_SHA, ACTOR_EMAIL
77

8-
# Alternate Usage: ./scripts/release/tps_record_release <component-slug> <release-id>
8+
# Alternate Usage: ./scripts/release/tps-record-release <component-slug> <release-sha>
99
# Required env vars: TPS_API_TOKEN, ACTOR_EMAIL
1010

11-
# Alternate Usage: ./scripts/release/tps_record_release <component-slug> <release-id> <email>
11+
# Alternate Usage: ./scripts/release/tps-record-release <component-slug> <release-sha> <email>
1212
# Required env vars: TPS_API_TOKEN
1313

1414
if [ -z "${TPS_HOSTNAME:-}" ]; then
@@ -33,6 +33,7 @@ if [ -z "$release_sha" ]; then
3333
exit 1
3434
fi
3535

36+
# The actor email must be a Salesforce email address
3637
actor_email="${3:-$ACTOR_EMAIL}"
3738
if [ -z "$actor_email" ]; then
3839
echo "Requires third argument or env var ACTOR_EMAIL: email of actor performing the release" >&2

0 commit comments

Comments
 (0)