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
86 changes: 26 additions & 60 deletions .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,42 +147,7 @@ jobs:
NEW_VERSION="${{ steps.calc-version.outputs.new_version }}"
CHANGELOG_FILE="${{ steps.changelog-diff.outputs.changelog_file }}"
RELEASE_DATE=$(date +%Y-%m-%d)

# Read the changelog content
CHANGELOG_CONTENT=$(cat "$CHANGELOG_FILE")

# Create new changelog section
NEW_SECTION="## v${NEW_VERSION} (${RELEASE_DATE})

### Changes

${CHANGELOG_CONTENT}
"

# Insert new section after "## Upcoming" section
node -e "
const fs = require('fs');
let content = fs.readFileSync('CHANGELOG.md', 'utf8');

const newSection = \`$NEW_SECTION\`;

// Find the Upcoming section and insert after it
const upcomingMatch = content.match(/## Upcoming[\s\S]*?(?=\n## v|$)/);
if (upcomingMatch) {
const upcomingEnd = content.indexOf(upcomingMatch[0]) + upcomingMatch[0].length;
content = content.slice(0, upcomingEnd) + '\n' + newSection + content.slice(upcomingEnd);
} else {
// No Upcoming section, prepend
content = '## Upcoming\n\n' + newSection + content;
}

// Reset the Upcoming section to empty
content = content.replace(/## Upcoming[\s\S]*?(?=\n## v)/, '## Upcoming\n\n### New\n\n### Fixes\n\n');

fs.writeFileSync('CHANGELOG.md', content);
"

echo "Updated CHANGELOG.md"
node scripts/update-changelog.js "$NEW_VERSION" "$RELEASE_DATE" "$CHANGELOG_FILE"

- name: Create release branch and commit
id: create-branch
Expand Down Expand Up @@ -215,36 +180,37 @@ ${CHANGELOG_CONTENT}
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEW_VERSION: ${{ steps.calc-version.outputs.new_version }}
BRANCH_NAME: ${{ steps.create-branch.outputs.branch_name }}
CHANGELOG_FILE: ${{ steps.changelog-diff.outputs.changelog_file }}
run: |
NEW_VERSION="${{ steps.calc-version.outputs.new_version }}"
BRANCH_NAME="${{ steps.create-branch.outputs.branch_name }}"
CHANGELOG_FILE="${{ steps.changelog-diff.outputs.changelog_file }}"

CHANGELOG_CONTENT=$(cat "$CHANGELOG_FILE")

PR_BODY="## Release v${NEW_VERSION}

This PR prepares the release of version **${NEW_VERSION}** for all packages.

### Packages Updated
- \`@microsoft/durabletask-js@${NEW_VERSION}\`
- \`@microsoft/durabletask-js-azuremanaged@${NEW_VERSION}\`

### Changes Since Last Release
${CHANGELOG_CONTENT}

### Release Checklist
- [ ] Review version bumps in package.json files
- [ ] Review CHANGELOG.md updates
- [ ] Verify CI passes
- [ ] Merge this PR
- [ ] After merge, the official build pipeline will produce signed artifacts
- [ ] Download artifacts and publish to npm with appropriate tag
"
# Write PR body to a temp file to avoid YAML escaping issues
cat > /tmp/pr_body.md << EOF
## Release v${NEW_VERSION}

This PR prepares the release of version **${NEW_VERSION}** for all packages.

**Packages Updated:**
- @microsoft/durabletask-js@${NEW_VERSION}
- @microsoft/durabletask-js-azuremanaged@${NEW_VERSION}

**Changes Since Last Release:**
${CHANGELOG_CONTENT}

**Release Checklist:**
- [ ] Review version bumps in package.json files
- [ ] Review CHANGELOG.md updates
- [ ] Verify CI passes
- [ ] Merge this PR
- [ ] After merge, the official build pipeline will produce signed artifacts
- [ ] Download artifacts and publish to npm with appropriate tag
EOF

gh pr create \
--title "Release v${NEW_VERSION}" \
--body "$PR_BODY" \
--body-file /tmp/pr_body.md \
--base main \
--head "$BRANCH_NAME" \
--label "release"
Expand Down
37 changes: 37 additions & 0 deletions scripts/update-changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env node
// This script updates CHANGELOG.md with a new release section
// Usage: node update-changelog.js <version> <date> <changelog-file>

const fs = require('fs');

const [,, version, releaseDate, changelogFile] = process.argv;

if (!version || !releaseDate || !changelogFile) {
console.error('Usage: node update-changelog.js <version> <date> <changelog-file>');
process.exit(1);
}

const changelogContent = fs.readFileSync(changelogFile, 'utf8').trim();
Comment on lines +2 to +14
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script’s CLI contract/documentation is misleading: the third arg is named like a changelog file to update, but the script always reads/writes the hard-coded CHANGELOG.md and uses the arg only as the source of release notes. Consider renaming the arg/usage text (e.g., release-notes-file) or adding an explicit target path parameter and using it instead of hard-coding CHANGELOG.md.

Suggested change
// This script updates CHANGELOG.md with a new release section
// Usage: node update-changelog.js <version> <date> <changelog-file>
const fs = require('fs');
const [,, version, releaseDate, changelogFile] = process.argv;
if (!version || !releaseDate || !changelogFile) {
console.error('Usage: node update-changelog.js <version> <date> <changelog-file>');
process.exit(1);
}
const changelogContent = fs.readFileSync(changelogFile, 'utf8').trim();
// This script updates CHANGELOG.md with a new release section using the provided release notes file
// Usage: node update-changelog.js <version> <date> <release-notes-file>
const fs = require('fs');
const [,, version, releaseDate, releaseNotesFile] = process.argv;
if (!version || !releaseDate || !releaseNotesFile) {
console.error('Usage: node update-changelog.js <version> <date> <release-notes-file>');
process.exit(1);
}
const changelogContent = fs.readFileSync(releaseNotesFile, 'utf8').trim();

Copilot uses AI. Check for mistakes.
let content = fs.readFileSync('CHANGELOG.md', 'utf8');

const newSection = `## v${version} (${releaseDate})

### Changes

${changelogContent}
Comment on lines +17 to +21
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New release entries are created with a ### Changes subsection, but the existing CHANGELOG.md uses ### New / ### Fixes subsections for versioned releases. Please align the generated section headings with the established changelog structure (or update the changelog format consistently across existing entries).

Copilot uses AI. Check for mistakes.
`;

// Find the Upcoming section and insert after it
const upcomingMatch = content.match(/## Upcoming[\s\S]*?(?=\n## v|$)/);
if (upcomingMatch) {
const upcomingEnd = content.indexOf(upcomingMatch[0]) + upcomingMatch[0].length;
content = content.slice(0, upcomingEnd) + '\n' + newSection + content.slice(upcomingEnd);
} else {
content = '## Upcoming\n\n' + newSection + content;
}

// Reset the Upcoming section to empty
content = content.replace(/## Upcoming[\s\S]*?(?=\n## v)/, '## Upcoming\n\n### New\n\n### Fixes\n\n');

fs.writeFileSync('CHANGELOG.md', content);
console.log('Updated CHANGELOG.md');
Loading