Skip to content

Commit a4f5464

Browse files
Fix/workflows (#494)
* chore: fix precommit flow * feat: update release workflows to use new changelog generation script
1 parent 28a3a16 commit a4f5464

File tree

8 files changed

+918
-94
lines changed

8 files changed

+918
-94
lines changed

.github/workflows/create-beta-release.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,20 +130,18 @@ jobs:
130130
- name: Generate Changelog
131131
run: |
132132
VERSION=${{ steps.bump_version.outputs.new_version }}
133-
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
134-
135-
# Create docs directory if it doesn't exist
136-
mkdir -p docs
137-
138-
echo "# Changelog for v$VERSION (Beta)" > docs/CHANGELOG.md
139-
echo "" >> docs/CHANGELOG.md
140-
echo "This is a beta release from the staging branch. Changes since last tag:" >> docs/CHANGELOG.md
141-
echo "" >> docs/CHANGELOG.md
142-
if [[ -n "$LAST_TAG" ]]; then
143-
git log $LAST_TAG..HEAD --pretty=format:"- %s (%h)" >> docs/CHANGELOG.md
144-
else
145-
git log -n 20 --pretty=format:"- %s (%h)" >> docs/CHANGELOG.md
146-
fi
133+
134+
# Make the changelog generator executable
135+
chmod +x scripts/generate-changelog.js
136+
137+
# Generate changelog using the new script
138+
node scripts/generate-changelog.js "$VERSION" beta
139+
140+
echo "✅ Changelog generated successfully"
141+
142+
# Show preview
143+
echo "📋 Changelog preview:"
144+
head -20 docs/CHANGELOG.md
147145
148146
- name: Format Generated Files
149147
run: |

.github/workflows/create-stable-release.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,20 +120,18 @@ jobs:
120120
- name: Generate Stable Changelog
121121
run: |
122122
VERSION=${{ steps.convert_version.outputs.stable_version }}
123-
LAST_STABLE_TAG=$(git tag -l | grep -v beta | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1 || echo "")
124123
125-
# Create docs directory if it doesn't exist
126-
mkdir -p docs
124+
# Make the changelog generator executable
125+
chmod +x scripts/generate-changelog.js
127126
128-
echo "# Changelog for v$VERSION (Stable)" > docs/CHANGELOG.md
129-
echo "" >> docs/CHANGELOG.md
130-
echo "This is a stable release. Changes since last stable release:" >> docs/CHANGELOG.md
131-
echo "" >> docs/CHANGELOG.md
132-
if [[ -n "$LAST_STABLE_TAG" ]]; then
133-
git log $LAST_STABLE_TAG..HEAD --pretty=format:"- %s (%h)" >> docs/CHANGELOG.md
134-
else
135-
git log -n 20 --pretty=format:"- %s (%h)" >> docs/CHANGELOG.md
136-
fi
127+
# Generate stable changelog using the new script
128+
node scripts/generate-changelog.js "$VERSION" stable
129+
130+
echo "✅ Stable changelog generated successfully"
131+
132+
# Show preview
133+
echo "📋 Stable changelog preview:"
134+
head -20 docs/CHANGELOG.md
137135
138136
- name: Format Generated Files
139137
run: |

.github/workflows/publish-beta-npm.yml

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -108,48 +108,53 @@ jobs:
108108
echo "stable_version=$STABLE_VERSION" >> $GITHUB_OUTPUT
109109
echo "Stable version will be: $STABLE_VERSION"
110110
111-
- name: Create Promotion PR to Dev First
111+
- name: Create Success Summary
112112
if: steps.check_published.outputs.already_published != 'true'
113-
uses: peter-evans/create-pull-request@v6
114-
with:
115-
token: ${{ secrets.GITHUB_TOKEN }}
116-
head: release
117-
base: dev
118-
branch: promote/beta-to-stable-${{ steps.verify_version.outputs.version }}
119-
title: 'feat: promote beta ${{ steps.verify_version.outputs.version }} to stable'
120-
body: |
121-
**Promote Beta to Stable Release**
122-
123-
Beta version `${{ steps.verify_version.outputs.version }}` has been published to NPM from the staging branch and is ready for promotion to stable.
124-
125-
**Current Status:**
126-
- ✅ Beta version published to NPM with `beta` tag
127-
- ✅ GitHub beta release created
128-
- 🔄 Ready for stable release process
129-
130-
**Next Steps:**
131-
1. Review and merge this PR to dev branch first
132-
2. Manually create PR from dev → staging and merge
133-
3. Manually create PR from staging → main and merge
134-
4. Trigger "Create Stable Release" workflow to create stable GitHub release
135-
5. Trigger "Publish Stable to NPM" workflow to publish with `latest` tag
136-
137-
**Version Info:**
138-
- Beta: `${{ steps.verify_version.outputs.version }}`
139-
- Stable: `${{ steps.stable_version.outputs.stable_version }}` (will be created when promoted)
140-
141-
**staging Branch Strategy:**
142-
- Beta was published from `staging` branch
143-
- All automatic PRs go to `dev` first, then manually merged to `staging` and `main`
144-
- This prevents issues with ongoing development in `dev` branch
145-
146-
---
147-
*This PR was automatically created after successful beta NPM publish*
148-
labels: |
149-
automated
150-
release
151-
stable-promotion
152-
assignees: ${{ github.actor }}
113+
run: |
114+
echo "## 🎉 Beta Release Published Successfully!" >> $GITHUB_STEP_SUMMARY
115+
echo "" >> $GITHUB_STEP_SUMMARY
116+
echo "**Package**: \`@juspay/blend-design-system\`" >> $GITHUB_STEP_SUMMARY
117+
echo "**Version**: \`${{ steps.verify_version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
118+
echo "**NPM Tag**: \`beta\`" >> $GITHUB_STEP_SUMMARY
119+
echo "" >> $GITHUB_STEP_SUMMARY
120+
echo "### Installation" >> $GITHUB_STEP_SUMMARY
121+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
122+
echo "npm install @juspay/blend-design-system@beta" >> $GITHUB_STEP_SUMMARY
123+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
124+
echo "" >> $GITHUB_STEP_SUMMARY
125+
echo "### Next Steps" >> $GITHUB_STEP_SUMMARY
126+
echo "- ✅ Beta version is now live on NPM" >> $GITHUB_STEP_SUMMARY
127+
echo "- ✅ GitHub beta release is available" >> $GITHUB_STEP_SUMMARY
128+
echo "- 🔄 Test the beta version thoroughly" >> $GITHUB_STEP_SUMMARY
129+
echo "- 🔄 When ready, promote to stable using 'Create Stable Release' workflow" >> $GITHUB_STEP_SUMMARY
130+
131+
- name: Verify NPM Package After Publish
132+
if: steps.check_published.outputs.already_published != 'true'
133+
run: |
134+
cd packages/blend
135+
PACKAGE_NAME=$(node -p "require('./package.json').name")
136+
VERSION="${{ steps.verify_version.outputs.version }}"
137+
138+
echo "Verifying published beta package..."
139+
sleep 10 # Wait for NPM to propagate
140+
141+
PUBLISHED_VERSION=$(npm view "$PACKAGE_NAME@beta" version 2>/dev/null || echo "")
142+
if [[ "$PUBLISHED_VERSION" == "$VERSION" ]]; then
143+
echo "✅ Successfully verified: $PACKAGE_NAME@$VERSION is live on NPM with beta tag"
144+
else
145+
echo "⚠️ Warning: Expected $VERSION but NPM shows $PUBLISHED_VERSION for beta tag"
146+
echo "This might be due to NPM propagation delay"
147+
fi
148+
149+
# Also check if we can download and list the package
150+
echo "📦 Testing package download..."
151+
npm view "$PACKAGE_NAME@beta" --json > /tmp/package-info.json || echo "Could not download package info"
152+
153+
if [[ -f /tmp/package-info.json ]]; then
154+
echo "✅ Package info downloaded successfully"
155+
echo "📋 Package details:"
156+
cat /tmp/package-info.json | jq -r '.name, .version, .description' 2>/dev/null || echo "Basic package info verified"
157+
fi
153158
154159
- name: Skip Publishing (Already Published)
155160
if: steps.check_published.outputs.already_published == 'true'

.github/workflows/publish-stable-npm.yml

Lines changed: 56 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -117,36 +117,69 @@ jobs:
117117
echo "⚠️ Warning: Expected $VERSION but NPM shows $PUBLISHED_VERSION for latest tag"
118118
fi
119119
120-
- name: Update Release Notes
120+
- name: Generate Enhanced Release Notes
121121
if: steps.check_published.outputs.already_published != 'true'
122-
uses: softprops/action-gh-release@v2
123-
with:
124-
tag_name: v${{ steps.verify_version.outputs.version }}
125-
name: Release v${{ steps.verify_version.outputs.version }}
126-
body: |
127-
# Release v${{ steps.verify_version.outputs.version }}
122+
run: |
123+
VERSION="${{ steps.verify_version.outputs.version }}"
124+
125+
# Generate enhanced release notes
126+
cat > /tmp/release-notes.md << EOF
127+
# 🎉 Stable Release v${VERSION}
128+
129+
**This stable release is now published to NPM and ready for production use!**
130+
131+
## 📦 Installation
132+
133+
\`\`\`bash
134+
# Install latest stable version
135+
npm install @juspay/blend-design-system@latest
136+
137+
# Install specific version
138+
npm install @juspay/blend-design-system@${VERSION}
128139
129-
🎉 **Stable release published to NPM!**
140+
# Yarn
141+
yarn add @juspay/blend-design-system@latest
142+
\`\`\`
130143
131-
## Installation
132-
```bash
133-
npm install @juspay/blend-design-system@latest
134-
# or
135-
npm install @juspay/blend-design-system@${{ steps.verify_version.outputs.version }}
136-
```
144+
## 📋 Package Information
137145
138-
## NPM Package Info
139-
- **Package**: `@juspay/blend-design-system`
140-
- **Version**: `${{ steps.verify_version.outputs.version }}`
141-
- **Tag**: `latest`
142-
- **Published**: $(date -u)
146+
| Property | Value |
147+
|----------|-------|
148+
| **Package** | \`@juspay/blend-design-system\` |
149+
| **Version** | \`${VERSION}\` |
150+
| **NPM Tag** | \`latest\` |
151+
| **Published** | $(date -u '+%Y-%m-%d %H:%M:%S UTC') |
152+
| **Node Compatibility** | >=18.0.0 |
143153
144-
## What's Changed
145-
This stable release includes all changes from the corresponding beta version.
154+
## 🚀 What's Included
146155
147-
---
156+
This stable release includes all features and fixes from the corresponding beta version, thoroughly tested and ready for production environments.
148157
149-
**Full Changelog**: https://github.com/juspay/blend-design-system/releases
158+
## 📚 Documentation & Resources
159+
160+
- [📖 Component Documentation](https://your-docs-url.com)
161+
- [🎨 Storybook](https://your-storybook-url.com)
162+
- [🔧 Migration Guide](https://github.com/juspay/blend-design-system/blob/main/MIGRATION.md)
163+
- [🐛 Report Issues](https://github.com/juspay/blend-design-system/issues/new)
164+
165+
## 🔗 Quick Links
166+
167+
- [View on NPM](https://www.npmjs.com/package/@juspay/blend-design-system)
168+
- [Full Changelog](https://github.com/juspay/blend-design-system/blob/main/docs/CHANGELOG.md)
169+
- [Release Notes](https://github.com/juspay/blend-design-system/releases)
170+
171+
---
172+
173+
**🙏 Thank you for using Blend Design System!**
174+
EOF
175+
176+
- name: Update GitHub Release with Enhanced Notes
177+
if: steps.check_published.outputs.already_published != 'true'
178+
uses: softprops/action-gh-release@v2
179+
with:
180+
tag_name: v${{ steps.verify_version.outputs.version }}
181+
name: Release v${{ steps.verify_version.outputs.version }}
182+
body_path: /tmp/release-notes.md
150183
draft: false
151184
prerelease: false
152185

.husky/pre-commit

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
echo "Running code formatting..."
2-
pnpm format
3-
41
echo "Checking code formatting..."
5-
pnpm format:check
2+
if ! pnpm format:check; then
3+
echo "Code formatting issues found. Auto-formatting files..."
4+
pnpm format
5+
echo "Adding formatted files to staging area..."
6+
git add .
7+
echo "Files formatted and staged successfully!"
8+
else
9+
echo "Code formatting is already correct!"
10+
fi
611

712
echo "Pre-commit checks passed!"

0 commit comments

Comments
 (0)