mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-10-30 15:19:21 +00:00
* feat: add automated Storybook snapshot testing with CI integration This PR introduces automated Jest snapshot testing for all Storybook stories using the Portable Stories API. - **Test Setup**: Created automated test file that discovers and generates JSON snapshots for all `.stories.tsx` files - **CI Pipeline**: Added GitHub Actions workflow to run snapshot tests on PRs and main branch pushes - **Scripts**: Added `test:storybook` and `test:storybook:ci` npm scripts - **Documentation**: Created comprehensive guide in `STORYBOOK_SNAPSHOTS.md` - Automatically catches unintended UI changes in components - Provides reviewable diffs in pull requests - Fast execution compared to visual regression tests - Version-controlled snapshot history - Zero configuration required - automatically discovers all stories ```bash yarn test:storybook # Run tests locally yarn test:storybook -u # Update snapshots ``` The CI workflow runs automatically on changes to `apps/web/**` and will fail if snapshots don't match, uploading diffs as artifacts for review. fix: move docs to docs folder and add workflow permissions - Move STORYBOOK_SNAPSHOTS.md to docs/storybook-snapshots.md - Add permissions block to workflow for security (contents: read) - Fixes CodeQL security warning about GITHUB_TOKEN permissions fix: use globSync for Jest compatibility - Change from glob.sync to globSync import - Fixes ES module import error in Jest feat: Add automated release workflows for one-button releases Implements GitHub Actions workflows to automate the release process, reducing manual steps from ~20 CLI commands to 3 button clicks via GitHub's web UI. - **Start Web Release**: Creates release branch, bumps version, generates changelog, and creates PR automatically - **Complete Web Release**: Merges PR after QA approval and triggers deployment - **Back-merge Main to Dev**: Automatically syncs main back to dev with conflict detection - Enhanced changelog generator with categorization and statistics - Slack notification helper for all release events - Scripts documentation - Complete automated release procedure guide in release-procedure-automated.md - Updated legacy manual procedure with deprecation notice - 85% reduction in manual steps (20 → 3) - 83% faster releases (30-60 min → 5-10 min) - Zero CLI expertise required - Accessible to non-technical team members - Reduced error rate with validation - Automated Slack notifications (optional) - No breaking changes - manual process still works - Existing deployment workflows unchanged - QA approval process remains manual and human-controlled - Easy rollback if needed fix: Address PR review comments - Add version extraction validation in complete workflow - Fix Slack notification JSON injection using jq - Improve error messages with clearer formatting - Add concurrent release check to prevent conflicts - Fix conditional in back-merge workflow PR body Addresses review feedback from Copilot review. chore: Revert storybook-related changes in package.json and .gitignore These changes were unrelated to the release automation feature. * fix: improve release workflow reliability and PR description - Change base branch from dev to main for regular releases - Remove project board step (not used) - Fix PR creation by removing cd to apps/web subdirectory - Restore release label for PR tagging - Remove backmerge and conflicts labels from backmerge workflow - Exclude merge commits from changelog tables - Move release metadata to bottom of PR description for better readability * chore: remove redundant Complete Web Release workflow The web-tag-release workflow already handles tagging and GitHub release creation automatically when PRs are merged to main, making this workflow unnecessary. * feat: auto-publish releases and add Slack notifications - Publish GitHub releases immediately instead of as drafts - Send Slack notification to #topic-wallet-releases after production deployment - Include version and release notes link in notification * docs: update automated release documentation - Remove references to deleted Complete Web Release workflow - Update release process to reflect auto-publish releases - Add Slack notification to #topic-wallet-releases channel - Simplify workflow from 3 steps to 2 (start + back-merge) - Update base branch documentation (main for both regular and hotfix) - Add release documentation link to root README - Update workflow comparison table and diagrams * chore: update Slack notification message for releases Change notification to indicate release is "ready for going live" instead of "released to production", with GitHub release link. * Update package.json * feat: add auto-increment version support to release workflow Allow leaving the version input empty to automatically increment based on release type: - Regular releases: increment minor version (middle number), reset patch Example: 1.73.0 → 1.74.0 - Hotfix releases: increment patch version (last number) Example: 1.73.0 → 1.73.1 Manual version input still supported with validation. All internal references updated to use step outputs instead of direct input references. Tested locally with comprehensive unit and scenario tests (17/17 passed). * fix: address Copilot review feedback for auto-increment feature Security and reliability improvements: - Add validation for version extraction from package.json - Validate parsed version components before incrementing - Fix JSON injection vulnerability in Slack notification using jq - Improve error messages with clear expected formats These changes address the Copilot review comments to ensure the auto-increment feature handles edge cases and prevents security issues. * chore: clean up release documentation - Remove comparison to manual workflow from documentation - Remove "last modified" date from automated release docs - Remove legacy scripts section from release README --------- Co-authored-by: Hanzo Dev <[email protected]>
141 lines
3.0 KiB
Bash
Executable File
141 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Slack notification helper for releases
|
|
# Usage: ./notify-slack.sh <event_type> <version> [additional_info]
|
|
|
|
set -e
|
|
|
|
EVENT_TYPE=$1
|
|
VERSION=$2
|
|
ADDITIONAL_INFO=${3:-""}
|
|
|
|
# Check if Slack webhook is configured
|
|
if [ -z "$SLACK_WEBHOOK_URL" ]; then
|
|
echo "⚠️ SLACK_WEBHOOK_URL not configured. Skipping Slack notification."
|
|
exit 0
|
|
fi
|
|
|
|
# Determine message based on event type
|
|
case "$EVENT_TYPE" in
|
|
"release_started")
|
|
EMOJI="🚀"
|
|
TITLE="Release Started"
|
|
MESSAGE="Release v$VERSION has been initiated and is ready for QA testing."
|
|
COLOR="#36a64f"
|
|
;;
|
|
"qa_approved")
|
|
EMOJI="✅"
|
|
TITLE="QA Approved"
|
|
MESSAGE="Release v$VERSION has been approved by QA and merged to main."
|
|
COLOR="#36a64f"
|
|
;;
|
|
"release_published")
|
|
EMOJI="🎉"
|
|
TITLE="Release Published"
|
|
MESSAGE="Release v$VERSION has been published and deployed to production."
|
|
COLOR="#7CD197"
|
|
;;
|
|
"backmerge_complete")
|
|
EMOJI="🔄"
|
|
TITLE="Back-merge Complete"
|
|
MESSAGE="Changes from main have been merged back to dev."
|
|
COLOR="#5865F2"
|
|
;;
|
|
"backmerge_conflict")
|
|
EMOJI="⚠️"
|
|
TITLE="Back-merge Conflicts"
|
|
MESSAGE="Back-merge from main to dev has conflicts. Manual resolution required."
|
|
COLOR="#FFA500"
|
|
;;
|
|
"release_failed")
|
|
EMOJI="❌"
|
|
TITLE="Release Failed"
|
|
MESSAGE="Release v$VERSION encountered an error: $ADDITIONAL_INFO"
|
|
COLOR="#FF0000"
|
|
;;
|
|
*)
|
|
echo "Unknown event type: $EVENT_TYPE"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# Build JSON payload
|
|
PAYLOAD=$(cat <<EOF
|
|
{
|
|
"text": "$EMOJI $TITLE",
|
|
"blocks": [
|
|
{
|
|
"type": "header",
|
|
"text": {
|
|
"type": "plain_text",
|
|
"text": "$EMOJI $TITLE"
|
|
}
|
|
},
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "*Version:* $VERSION\n*Status:* $MESSAGE"
|
|
}
|
|
}
|
|
EOF
|
|
)
|
|
|
|
# Add additional info if provided
|
|
if [ -n "$ADDITIONAL_INFO" ]; then
|
|
PAYLOAD="$PAYLOAD"$(cat <<EOF
|
|
,
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "$ADDITIONAL_INFO"
|
|
}
|
|
}
|
|
EOF
|
|
)
|
|
fi
|
|
|
|
# Add workflow link if available
|
|
if [ -n "$GITHUB_RUN_ID" ]; then
|
|
WORKFLOW_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
|
|
PAYLOAD="$PAYLOAD"$(cat <<EOF
|
|
,
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "<$WORKFLOW_URL|View Workflow Run>"
|
|
}
|
|
}
|
|
EOF
|
|
)
|
|
fi
|
|
|
|
# Close JSON
|
|
PAYLOAD="$PAYLOAD"$(cat <<EOF
|
|
],
|
|
"attachments": [
|
|
{
|
|
"color": "$COLOR",
|
|
"footer": "Safe Wallet Release Bot",
|
|
"footer_icon": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
|
"ts": $(date +%s)
|
|
}
|
|
]
|
|
}
|
|
EOF
|
|
)
|
|
|
|
# Send notification
|
|
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X POST "$SLACK_WEBHOOK_URL" \
|
|
-H 'Content-Type: application/json' \
|
|
-d "$PAYLOAD")
|
|
|
|
if [ "$RESPONSE" = "200" ]; then
|
|
echo "✅ Slack notification sent successfully"
|
|
else
|
|
echo "⚠️ Failed to send Slack notification (HTTP $RESPONSE)"
|
|
exit 1
|
|
fi
|