Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(release): Update publishing procedure #1340

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
82 changes: 20 additions & 62 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,80 +187,38 @@ To install both tools: `npm i -g npm-check npm-check-updates`.

## Publishing

First, follow the instructions in [docs/building.md](docs/building.md).
1. Prepare the release notes.

```sh
cargo install git-cliff
```
- Execute the following command to extract git commit comments since the last release:

```sh
# git-cliff --tag <new version> <current version>..HEAD | pbcopy
git-cliff --tag 1.0.1 v1.0.0..HEAD | pbcopy
```
```sh
# git-cliff --tag <new version> <current version>..HEAD | pbcopy
# e.g.: git-cliff --tag 1.0.1 v1.0.0..HEAD | pbcopy

- Paste into [CHANGELOG.md](CHANGELOG.md)
# If git-cliff is not yet installed, first do:
# cargo install git-cliff
```

- Paste that in a text editor
- Clean up formatting
- Add any important missing details
- Replace PR numbers with links:

```
#(\d{3})
[#$1](https://github.com/temporalio/sdk-typescript/pull/$1)
```

- If PRs came from external contributors, thank them & link their github handles: `([#484](link), thanks to [`@user`](https://github.com/user) 🙏)`
- Open PR with CHANGELOG change
- If using a custom [features](https://github.com/temporalio/features) branch for PR integration tests, make
sure the branch is fully up-to-date with `features` `main` before merging the CHANGELOG PR
- Merge PR
- Checkout latest `main`

We're [working on automating](https://github.com/temporalio/sdk-typescript/pull/395) the rest of the process:

- Log in to npm as `temporal-sdk-team` (`npm whoami` and `npm login`)
- Download the 5 `packages-*` artifacts from the PR's [GitHub Action](https://github.com/temporalio/sdk-typescript/actions)
- Publish:
- If PRs came from external contributors, thank them & link their github handles: `(#484, thanks to @user 🙏)`

```sh
#!/bin/bash
set -euo pipefail

git clean -fdx
npm ci
npm run build
2. Publish bundles

mkdir -p packages/core-bridge/releases
- Make sure you are logged in to NPM as `temporal-sdk-team` (`npm whoami` and `npm login`)

# in the next command, replace ~/gh/release-sdk-typescript with your dir
for f in ~/Downloads/packages-*.zip; do mkdir "$HOME/Downloads/$(basename -s .zip $f)"; (cd "$HOME/Downloads/$(basename -s .zip $f)" && unzip $f && tar -xvzf @temporalio/core-bridge/core-bridge-*.tgz package/releases/ && cp -r package/releases/* ~/gh/release-sdk-typescript/packages/core-bridge/releases/); done
- Run the following command:

# we should now have all 5 build targets
ls packages/core-bridge/releases/

npx lerna version patch --force-publish='*' # or major|minor|etc, or leave out to be prompted. either way, you get a confirmation dialog.

git checkout -B fix-deps
node scripts/prepublish.mjs
git commit -am 'Fix dependencies'
npx lerna publish from-package # add `--dist-tag next` for pre-release versions
git checkout -
```

Finally:

```
npm deprecate temporalio@^1.0.0 "Instead of installing temporalio, we recommend directly installing our packages: npm remove temporalio; npm install @temporalio/client @temporalio/worker @temporalio/workflow @temporalio/activity"
```

- Cleanup after publishing:

```sh
rm -rf $HOME/Downloads/packages-*
rm -rf packages/core-bridge/releases/*
```
zsh ./scripts/publish.sh
```

3. Other things

- If using a custom [features](https://github.com/temporalio/features/) branch for PR integration tests, merge
that branch into features `main` and update the SDK workflow definition to trigger `features` `main`
- If using a custom [features](https://github.com/temporalio/features) branch for PR integration tests, make
sure the branch is fully up-to-date with `features`

- If any APIs have changed, open a PR to update [`samples-typescript`](https://github.com/temporalio/samples-typescript/). Once merged, update the `next` branch:

Expand Down
32 changes: 0 additions & 32 deletions docs/building.md

This file was deleted.

123 changes: 123 additions & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#!/bin/zsh
set -euo pipefail

local workdir=$( mktemp -d -t sdk-typescript-release )
trap 'cd / && rm -rf "$workdir"' EXIT
cd "$workdir"

# FIXME Make this a parameter
# e.g. 'main' or 'releases/1.10.x'
source_branch=main

# Manually download all native artifacts from the latest build

mkdir -p artifacts package/releases
open artifacts

echo -e 'Please do the following:'
echo -e ' 1. Open the \e]8;;https://github.com/temporalio/sdk-typescript/actions/workflows/ci.yml?query=branch%3A'"$source_branch"'\e\\GHA status page\e]8;;\e\\ for the "Continuous Integration" workflow, on branch main.'
echo -e ' 2. From there, select the latest execution'
echo -e ' 3. Download all corebridge-native-* artifacts to the "artifacts" directory that just opened'

echo
echo -e 'Press ENTER once this is completed.'
read enterKey

local count=$( find artifacts -type f -name "corebridge-native-*.zip" | wc -l )
if [ $count -ne 5 ]; then
echo "The 'artifacts' directory does not contain exactly 5 files named 'corebridge-native-*.zip'"
echo "Aborting"
exit 1
fi

git clone --branch $source_branch --depth 1 --shallow-submodules --recurse-submodules https://github.com/temporalio/sdk-typescript.git
cd sdk-typescript

# Extract native libs and organize them correctly
for name in ../artifacts/*.zip ; do
unzip -q ${name} -d packages/core-bridge/releases/
done

npm ci --ignore-scripts
npm run build -- --ignore @temporalio/core-bridge

echo
echo 'Does this look correct?'
echo
ls -l packages/core-bridge/releases/*/*

echo
echo 'Press ENTER to go on with publishing, or Ctrl+C to abort'

read enterKey

echo 'Publishing...'

# User will be asked to indicate which type of release and to confirm,
# then the Publish commit will be created and pushed to the main branch.
npx lerna version --force-publish='*'

local version=$( jq -r '.version' < lerna.json )

git checkout -B fix-deps
node scripts/prepublish.mjs
git commit -am 'Fix dependencies'

# Check if the version matches the pattern
if [[ $version =~ '^[0-9]+\.[0-9]+\.[0-9]+$' ]]; then
npx lerna publish from-package
else
npx lerna publish from-package --dist-tag next
fi

npm deprecate "temporalio@^${version}" "Instead of installing temporalio, we recommend directly installing our packages: npm remove temporalio; npm install @temporalio/client @temporalio/worker @temporalio/workflow @temporalio/activity"

echo -e 'Please do the following:'
echo -e ' 1. Open the \e]8;https://github.com/temporalio/sdk-typescript/releases/new?tag=v'"$version"'\e\\GitHub New Release page\e]8;;\e\\ and select the 'v"$version"' tag.'
echo -e ' 2. In the Release Title field, enter '"$version"''
echo -e ' 3. Paste the release notes inkto the description field'
if [[ $version =~ '^[0-9]+\.[0-9]+\.[0-9]+$' ]]; then
echo -e ' 4. Make sure that the "Set as a pre-release" checkbox is unchecked'
echo -e ' and that the "Set as the latest release" checkbox is checked'
else
echo -e ' 4. Make sure that the "Set as a pre-release" checkbox is checked'
echo -e ' and that the "Set as the latest release" checkbox is unchecked'
fi
echo -e ' 5. Press the "Save draft" button, then ask someone else to review'
echo -e ' 6. Press the "Publish Release" buton to complete the release process'

echo
echo -e 'Press ENTER once this is completed.'
read enterKey

cd "$workdir"

if [[ $version =~ '^[0-9]+\.[0-9]+\.[0-9]+$' ]]; then

##
# Update the samples repo
##

(
git clone --depth 1 --shallow-submodules --recurse-submodules https://github.com/temporalio/samples-typescript.git
cd samples-typescript

npm i

# Update all samples
zx .scripts/upgrade-versions.mjs "^${version}"

# Update the package.json file
npm i

git checkout -b "typescript-${version}"
git add --all
git commit -m "Update TS SDK to ${version}"
git push

gh pr create \
--title "Update TS SDK to ${version}" \
--body "## What changed"$'\n\n'"- Update TS SDK to ${version}" \
--head "typescript-${version}"
)
fi
Loading