Skip to content

Commit 2957815

Browse files
authored
Release @microsoft/durabletask-js-azuremanaged@0.4.0 (#343)
1 parent 459d64e commit 2957815

4 files changed

Lines changed: 82 additions & 47 deletions

File tree

.github/workflows/prepare-release.yaml

Lines changed: 74 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -87,43 +87,49 @@ jobs:
8787
8888
- name: Calculate next version
8989
id: calc-version
90+
env:
91+
INPUT_VERSION: ${{ github.event.inputs.version }}
92+
CURRENT_VERSION: ${{ steps.get-current-version.outputs.current_version }}
9093
run: |
91-
INPUT_VERSION="${{ github.event.inputs.version }}"
92-
CURRENT_VERSION="${{ steps.get-current-version.outputs.current_version }}"
93-
94-
if [ -n "$INPUT_VERSION" ]; then
95-
# Use the specified version
96-
NEW_VERSION="$INPUT_VERSION"
97-
else
98-
# Auto-increment: parse current version and bump appropriately
99-
# Handle pre-release versions like 0.1.0-alpha.2 -> 0.1.0-alpha.3
100-
# Handle stable versions like 0.1.0 -> 0.1.1
101-
NEW_VERSION=$(node -e "
102-
const v = '$CURRENT_VERSION';
103-
const match = v.match(/^(\d+)\.(\d+)\.(\d+)(?:-([a-z]+)\.(\d+))?$/);
104-
if (!match) {
105-
console.log(v);
106-
process.exit(0);
107-
}
108-
const [, major, minor, patch, preType, preNum] = match;
109-
if (preType && preNum) {
110-
// Increment pre-release number
111-
console.log(\`\${major}.\${minor}.\${patch}-\${preType}.\${parseInt(preNum) + 1}\`);
112-
} else {
113-
// Increment patch version
114-
console.log(\`\${major}.\${minor}.\${parseInt(patch) + 1}\`);
115-
}
116-
")
94+
if ! NEW_VERSION=$(node -e '
95+
const pattern = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([a-z]+)\.(0|[1-9]\d*))?$/;
96+
const input = process.env.INPUT_VERSION;
97+
const current = process.env.CURRENT_VERSION;
98+
const currentMatch = current.match(pattern);
99+
100+
if (!currentMatch) {
101+
console.error(`::error::Current package version "${current}" is invalid. Expected MAJOR.MINOR.PATCH or MAJOR.MINOR.PATCH-PRERELEASE.NUMBER.`);
102+
process.exit(1);
103+
}
104+
if (input && !pattern.test(input)) {
105+
console.error(`::error::Release version "${input}" is invalid. Expected MAJOR.MINOR.PATCH or MAJOR.MINOR.PATCH-PRERELEASE.NUMBER.`);
106+
process.exit(1);
107+
}
108+
if (input) {
109+
console.log(input);
110+
process.exit(0);
111+
}
112+
113+
const [, major, minor, patch, preType, preNum] = currentMatch;
114+
const increment = (value) => (BigInt(value) + 1n).toString();
115+
console.log(preType
116+
? `${major}.${minor}.${patch}-${preType}.${increment(preNum)}`
117+
: `${major}.${minor}.${increment(patch)}`);
118+
'); then
119+
exit 1
117120
fi
118-
121+
119122
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
120123
echo "New version: $NEW_VERSION"
121124
122125
- name: Get latest release tag
123126
id: get-latest-tag
127+
env:
128+
PACKAGE: ${{ github.event.inputs.package }}
129+
CURRENT_VERSION: ${{ steps.get-current-version.outputs.current_version }}
130+
NEW_VERSION: ${{ steps.calc-version.outputs.new_version }}
131+
TAG_PREFIX: ${{ steps.resolve-package.outputs.tag_prefix }}
124132
run: |
125-
NEW_VERSION="${{ steps.calc-version.outputs.new_version }}"
126-
TAG_PREFIX="${{ steps.resolve-package.outputs.tag_prefix }}"
127133
# Get the latest tag for THIS package (its tag prefix), excluding the tag being
128134
# created so that re-runs don't use it as the baseline. The legacy core prefix "v"
129135
# still matches historical tags like v0.3.0 (intended, backward compatible) and never
@@ -135,8 +141,15 @@ jobs:
135141
LATEST_TAG=$(git -c versionsort.suffix=- tag -l "${TAG_PREFIX}*" --sort=-v:refname | \
136142
grep -v "^${TAG_PREFIX}${NEW_VERSION}$" | head -n 1)
137143
if [ -z "$LATEST_TAG" ]; then
138-
echo "No previous release tag found, using initial commit"
139-
LATEST_TAG=$(git rev-list --max-parents=0 HEAD)
144+
LEGACY_TAG="v${CURRENT_VERSION}"
145+
if [ "$PACKAGE" = "durabletask-js-azuremanaged" ] && \
146+
git rev-parse --verify --quiet "refs/tags/${LEGACY_TAG}" >/dev/null; then
147+
echo "No previous Azure Managed tag found; using legacy tag ${LEGACY_TAG}"
148+
LATEST_TAG="$LEGACY_TAG"
149+
else
150+
echo "No previous release tag found, using initial commit"
151+
LATEST_TAG=$(git rev-list --max-parents=0 HEAD)
152+
fi
140153
fi
141154
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
142155
echo "Latest tag: $LATEST_TAG"
@@ -157,7 +170,10 @@ jobs:
157170
# history into that package's changelog.
158171
# GitHub squash-merges put the PR number in parentheses, e.g. "Some change (#123)".
159172
# We convert "(#N)" to a markdown link.
160-
CHANGELOG_CONTENT=$(git log "$LATEST_TAG"..HEAD --pretty=format:"%s" --no-merges -- "$PKG_DIR" | \
173+
# Release commits only change version metadata and changelogs; listing them in the next
174+
# release repeats old release history instead of describing a product change.
175+
CHANGELOG_CONTENT=$(git log "$LATEST_TAG"..HEAD --pretty=format:"%s" --no-merges \
176+
--invert-grep --grep='^Release ' -- "$PKG_DIR" | \
161177
sed 's/(#\([0-9]*\))/([#\1](https:\/\/github.com\/microsoft\/durabletask-js\/pull\/\1))/' | \
162178
sed 's/^/- /' | \
163179
grep -v '^- $' || echo "")
@@ -170,22 +186,34 @@ jobs:
170186
cat /tmp/changelog_content.txt
171187
172188
- name: Update package version
189+
env:
190+
NEW_VERSION: ${{ steps.calc-version.outputs.new_version }}
191+
PKG_DIR: ${{ steps.resolve-package.outputs.pkg_dir }}
173192
run: |
174-
NEW_VERSION="${{ steps.calc-version.outputs.new_version }}"
175-
PKG_DIR="${{ steps.resolve-package.outputs.pkg_dir }}"
176-
177193
echo "Updating ${PKG_DIR} to version $NEW_VERSION..."
178-
179-
node -e "
180-
const fs = require('fs');
181-
const path = '${PKG_DIR}/package.json';
182-
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
183-
pkg.version = '$NEW_VERSION';
184-
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n');
185-
"
186-
194+
195+
node -e '
196+
const fs = require("fs");
197+
const packagePath = `${process.env.PKG_DIR}/package.json`;
198+
const pkg = JSON.parse(fs.readFileSync(packagePath, "utf8"));
199+
pkg.version = process.env.NEW_VERSION;
200+
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2) + "\n");
201+
202+
const lockPath = "package-lock.json";
203+
const lock = JSON.parse(fs.readFileSync(lockPath, "utf8"));
204+
const workspace = lock.packages?.[process.env.PKG_DIR];
205+
if (!workspace) {
206+
console.error(`::error::Workspace "${process.env.PKG_DIR}" is missing from ${lockPath}.`);
207+
process.exit(1);
208+
}
209+
workspace.version = process.env.NEW_VERSION;
210+
fs.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + "\n");
211+
'
212+
187213
echo "Updated ${PKG_DIR}/package.json:"
188214
grep '"version"' "${PKG_DIR}/package.json"
215+
echo "Updated ${PKG_DIR} in package-lock.json:"
216+
node -p "require('./package-lock.json').packages['${PKG_DIR}'].version"
189217
190218
- name: Update changelog
191219
run: |
@@ -236,8 +264,9 @@ jobs:
236264
# Create and checkout release branch (idempotent)
237265
git checkout -B "$BRANCH_NAME"
238266
239-
# Stage and commit changes (only the released package and its changelog)
267+
# Stage and commit changes (only the released package, lockfile, and its changelog)
240268
git add "${PKG_DIR}/package.json"
269+
git add package-lock.json
241270
git add "${CHANGELOG_PATH}"
242271
git commit -m "Release ${NPM_NAME}@${NEW_VERSION}"
243272

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99

1010
### Changes
1111

12+
- fix: trim whitespace from tenant values in connection string parsing ([#311](https://github.com/microsoft/durabletask-js/pull/311))
13+
- [copilot-finds] Bug: Fix off-by-one in createServiceConfig maxRetries→maxAttempts conversion ([#287](https://github.com/microsoft/durabletask-js/pull/287))
14+
- [copilot-finds] Improve: Add addEntity/addNamedEntity methods to DurableTaskAzureManagedWorkerBuilder ([#266](https://github.com/microsoft/durabletask-js/pull/266))
15+
- Fix race condition in AccessTokenCache concurrent token fetches ([#178](https://github.com/microsoft/durabletask-js/pull/178))
16+
- fix: preserve error cause in getHostAddress() for better debugging ([#194](https://github.com/microsoft/durabletask-js/pull/194))
17+
- [copilot-finds] Bug: Connection string parser uses case-sensitive key lookup ([#196](https://github.com/microsoft/durabletask-js/pull/196))
1218
- feat(durable-functions): restore worker-side callHttp ([#333](https://github.com/microsoft/durabletask-js/pull/333), fixes [#318](https://github.com/microsoft/durabletask-js/issues/318))
1319
- [copilot-finds] Bug: Entity getState() produces unhelpful SyntaxError for corrupted state ([#309](https://github.com/microsoft/durabletask-js/pull/309))
1420
- fix: prevent infinite loop in suspend/resume event buffer iteration ([#306](https://github.com/microsoft/durabletask-js/pull/306))

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/durabletask-js-azuremanaged/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/durabletask-js-azuremanaged",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"description": "Azure-managed Durable Task Scheduler support for the Durable Task JavaScript SDK",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

0 commit comments

Comments
 (0)