Skip to content

Commit 0dfe17b

Browse files
pftgqwencoder
andcommitted
simplify release workflow and docs
- Streamline release.yml to essential steps only - Remove complex changelog extraction (link instead) - Simplify RELEASE_PREP.md to concise checklist - One-click release: test → tag → publish → create release Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent 903b796 commit 0dfe17b

2 files changed

Lines changed: 53 additions & 185 deletions

File tree

.github/workflows/release.yml

Lines changed: 17 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,86 +5,58 @@ on:
55
workflow_dispatch:
66
inputs:
77
version:
8-
description: 'Release version (e.g., 1.12.0)'
8+
description: "Release version (e.g., 1.12.0)"
99
required: true
1010
type: string
1111

1212
jobs:
1313
release:
14-
name: Release ${{ github.event.inputs.version }} to RubyGems.org
14+
name: Release v${{ github.event.inputs.version }}
1515
runs-on: ubuntu-latest
1616

1717
permissions:
18-
id-token: write # Required for trusted publishing to RubyGems
19-
contents: write # Required to create release tag
18+
id-token: write
19+
contents: write
2020

2121
steps:
22-
# Setup
2322
- uses: actions/checkout@v6
24-
- name: Set up Ruby
25-
uses: ruby/setup-ruby@v1
23+
- uses: ruby/setup-ruby@v1
2624
with:
2725
bundler-cache: true
2826
ruby-version: ruby
2927

30-
# Verify version matches
3128
- name: Verify version
3229
run: |
3330
GEM_VERSION="${{ github.event.inputs.version }}"
34-
RUBY_VERSION=$(ruby -rlib/capybara/screenshot/diff/version -e "puts Capybara::Screenshot::Diff::VERSION")
35-
if [ "$GEM_VERSION" != "$RUBY_VERSION" ]; then
36-
echo "❌ Version mismatch!"
37-
echo "Input version: $GEM_VERSION"
38-
echo "Ruby version: $RUBY_VERSION"
31+
CODE_VERSION=$(ruby -rlib/capybara/screenshot/diff/version -e "puts Capybara::Screenshot::Diff::VERSION")
32+
if [ "$GEM_VERSION" != "$CODE_VERSION" ]; then
33+
echo "Version mismatch: input=$GEM_VERSION code=$CODE_VERSION"
3934
exit 1
4035
fi
41-
echo "✅ Version verified: $GEM_VERSION"
4236
43-
# Build and test
44-
- name: Run tests
37+
- name: Test
4538
run: bundle exec rake test
4639

47-
# Build is handled by rubygems/release-gem@v1 during publish
48-
49-
# Create and push tag
50-
- name: Create release tag
40+
- name: Create tag
5141
run: |
5242
git config user.name "github-actions[bot]"
5343
git config user.email "github-actions[bot]@users.noreply.github.com"
54-
55-
TAG_NAME="v${{ github.event.inputs.version }}"
56-
57-
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
58-
echo "Tag $TAG_NAME already exists; skipping tag creation."
59-
else
60-
git tag -a "$TAG_NAME" -m "Release $TAG_NAME"
61-
git push origin "$TAG_NAME"
62-
fi
63-
git tag -a "v${{ github.event.inputs.version }}" -m "Release v${{ github.event.inputs.version }}"
44+
git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}"
6445
git push origin "v${{ github.event.inputs.version }}"
6546
66-
# Publish to RubyGems
6747
- name: Publish to RubyGems
6848
uses: rubygems/release-gem@v1
6949

70-
# Create GitHub Release with changelog
71-
- name: Extract changelog
72-
run: |
73-
VERSION="${{ github.event.inputs.version }}"
74-
# Extract section for this version from CHANGELOG.md
75-
awk "/^## \[v${VERSION}\]/,/^## \[v/" CHANGELOG.md | head -n -1 > RELEASE_NOTES.md
76-
echo "## Changelog" >> RELEASE_NOTES.md
77-
echo "" >> RELEASE_NOTES.md
78-
echo "**Upgrade Guide:** See [docs/UPGRADING.md](https://github.com/${{ github.repository }}/blob/main/docs/UPGRADING.md) for detailed migration instructions." >> RELEASE_NOTES.md
79-
cat RELEASE_NOTES.md
80-
8150
- name: Create GitHub Release
8251
uses: softprops/action-gh-release@v2
8352
with:
8453
tag_name: "v${{ github.event.inputs.version }}"
8554
name: "v${{ github.event.inputs.version }}"
86-
body_path: RELEASE_NOTES.md
87-
draft: false
88-
generate_release_notes: false
55+
body: |
56+
## What's Changed
57+
58+
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md#v${{ github.event.inputs.version }}) for full details.
59+
60+
**Upgrade Guide:** [docs/UPGRADING.md](https://github.com/${{ github.repository }}/blob/main/docs/UPGRADING.md)
8961
env:
9062
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docs/RELEASE_PREP.md

Lines changed: 36 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,50 @@
1-
# Release Preparation — v1.12.0 (Minor Release)
1+
# Release Preparation — v1.12.0
22

33
## Summary
4-
This release represents **71 commits** since v1.11.0 with significant new features, performance improvements, and behavior changes. As a minor release, it maintains backward compatibility while introducing powerful new capabilities.
54

6-
## Why Minor Version (v1.12.0)?
7-
8-
### Behavior Changes (Non-Breaking)
9-
1. **SVN Support Removed** — Rarely used feature removed; no impact on Git users
10-
2. **Internal API Refactoring** — Private classes inlined; public API unchanged
11-
3. **Default Behavior Improvements**:
12-
- `blur_active_element` now defaults to `true` (better screenshots)
13-
- `hide_caret` now defaults to `true` (stable screenshots)
14-
- `fail_if_new` now defaults to `true` in CI environments (safer pipelines)
15-
16-
These changes improve the default experience without breaking existing configurations. Users who relied on the old defaults can explicitly override them.
17-
18-
### New Features Worth Highlighting
19-
- HTML Reporter with interactive visual diff dashboard
20-
- Standalone image comparison via `Diff.compare`
21-
- Perceptual color distance (dE00) for anti-aliasing tolerance
22-
- `assert_no_screenshot_changes` DSL method
23-
- `Diff.configure` block helper for simplified setup
24-
- Ruby 3.5 support
25-
- Ruby 4.0 compatibility
26-
27-
### Performance Improvements
28-
- Eliminated array allocations in ChunkyPNG shift-detection
29-
- Cached `without_tolerable_options?` at construction
30-
- Memoized `Difference#region_area_size`
31-
- Replaced method closures with blocks in BrowserHelpers
32-
33-
### Dependency Changes
34-
- Removed ActiveSupport runtime dependency (lighter installations)
35-
- Updated all GitHub Actions to latest versions
36-
- Pinned minitest to < 6
5+
71 commits since v1.11.0 with new features, performance improvements, and default behavior changes.
376

387
## Release Checklist
398

40-
### Pre-Release Preparation
41-
42-
- [x] Review CHANGELOG.md for accuracy
43-
- [x] Update version in `lib/capybara/screenshot/diff/version.rb` to `1.12.0`
44-
- [x] Run full test suite: `bundle exec rake test` (210 runs, 0 failures)
45-
- [ ] Run Docker tests: `bin/dtest` (optional, for thorough validation)
46-
- [ ] Re-record screenshot baselines if needed
47-
- [x] Commit changes: `git add CHANGELOG.md lib/capybara/screenshot/diff/version.rb docs/`
48-
- [x] Commit message: `chore: prepare v1.12.0 release`
49-
50-
### Release via GitHub Actions (Recommended)
51-
52-
This project uses GitHub Actions with trusted publishing to RubyGems.org.
53-
54-
#### Step 1: Push Changes to GitHub
55-
56-
```bash
57-
git push origin emdash/feat-re-review-git-history-8yi
58-
```
59-
60-
#### Step 2: Create GitHub Release (Draft)
61-
62-
1. Visit: https://github.com/donv/capybara-screenshot-diff/releases/new
63-
2. **Tag version:** `v1.12.0`
64-
3. **Release title:** `v1.12.0`
65-
4. **Description:** Copy content from `CHANGELOG.md` (the v1.12.0 section)
66-
5. **Add upgrade link:** Include link to `docs/UPGRADING.md`
67-
6. **Check:** ☑️ Set as a pre-release (optional, for review)
68-
7. Click **"Save draft"** or **"Publish release"**
69-
70-
This will automatically create the git tag `v1.12.0`.
71-
72-
#### Step 3: Trigger Release Workflow
73-
74-
After publishing the GitHub Release, the release workflow will be available to run manually:
9+
### Pre-Release
7510

76-
1. Visit: https://github.com/donv/capybara-screenshot-diff/actions/workflows/release.yml
77-
2. Click **"Run workflow"**
78-
3. Select the `v1.12.0` tag
79-
4. Click **"Run workflow"**
11+
- [x] Update version to `1.12.0`
12+
- [x] Run tests: `bundle exec rake test` (210 runs, 0 failures)
13+
- [x] Add CHANGELOG.md
14+
- [x] Add docs/UPGRADING.md
8015

81-
The workflow will:
82-
- Build the gem
83-
- Publish to RubyGems.org using trusted publishing (no API key needed)
84-
- Push the release tag to the repository
16+
### Release (One Click)
8517

86-
**Note:** The workflow requires `id-token: write` permission for trusted publishing and `contents: write` for tag management.
87-
88-
### Alternative: Manual Release via Rake
89-
90-
If you prefer manual release:
91-
92-
```bash
93-
# Build the gem
94-
bundle exec rake build
95-
96-
# Build and push to RubyGems (creates tag automatically)
97-
bundle exec rake release
98-
99-
# This will:
100-
# 1. Create tag v1.12.0
101-
# 2. Build capybara-screenshot-diff-1.12.0.gem
102-
# 3. Push tag to origin
103-
# 4. Push gem to https://rubygems.org/
104-
```
18+
1. Push to GitHub
19+
2. Go to [Actions → Release](https://github.com/donv/capybara-screenshot-diff/actions/workflows/release.yml)
20+
3. Click **Run workflow**, enter `1.12.0`
21+
4. Workflow will: test → tag → publish to RubyGems → create GitHub Release
10522

10623
### Post-Release
10724

108-
- [ ] Verify gem is available on RubyGems: https://rubygems.org/gems/capybara-screenshot-diff
109-
- [ ] Verify GitHub Release is published
110-
- [ ] Update CHANGELOG.md `[Unreleased]` link if needed
111-
- [ ] Announce release in relevant channels
112-
- [ ] Link to upgrade guide: `docs/UPGRADING.md`
113-
114-
## Migration Guide for Users
115-
116-
### What Users Need to Do
117-
118-
1. **If using SVN**: Migrate to Git — SVN support has been removed (rare)
119-
2. **If relying on `blur_active_element` or `hide_caret` being `false` by default**: Explicitly set them to `false` in your configuration
120-
3. **If running in CI and want to allow new screenshots**: Set `fail_if_new = false` explicitly
121-
4. **If using ActiveSupport**: No longer required at runtime — can remove dependency if only used for this gem
122-
5. **If using internal APIs**: Most users unaffected — only private classes refactored
25+
- [ ] Verify on [RubyGems](https://rubygems.org/gems/capybara-screenshot-diff)
26+
- [ ] Verify GitHub Release created
12327

124-
### What Works Out of the Box
28+
## What Changed
12529

126-
- ✅ Zero-config setup still works
127-
- ✅ Existing screenshot comparisons continue to work
128-
- ✅ HTML reporter — just `require 'capybara_screenshot_diff/reporters/html'`
129-
- ✅ New perceptual color distance for better anti-aliasing handling
130-
- ✅ All public APIs remain compatible
131-
132-
## Contributors
133-
134-
Top contributors (by commit count) since v1.11.0:
135-
- Review with: `git log v1.11.0..HEAD --format="%an" | sort | uniq -c | sort -rn`
136-
137-
## Statistics
138-
139-
- **Total commits**: 71
140-
- **Features added**: 8
141-
- **Bugs fixed**: 15
142-
- **Performance improvements**: 4
143-
- **Refactoring commits**: 17
144-
- **Documentation improvements**: 8
145-
- **Build/CI updates**: 12
146-
- **Files changed**: Review with `git diff --stat v1.11.0..HEAD`
147-
148-
## Next Steps
149-
150-
1. Review this document
151-
2. Approve version bump to v1.12.0
152-
3. Run tests
153-
4. Tag and publish release
154-
5. Announce upgrade guide at `docs/UPGRADING.md`
30+
### New Features
31+
- HTML reporter with interactive dashboard
32+
- `Diff.compare` for standalone image comparison
33+
- Perceptual color distance (dE00) for anti-aliasing
34+
- `assert_no_screenshot_changes` DSL method
35+
- `Diff.configure` block helper
36+
- Ruby 3.5 & 4.0 support
37+
38+
### Behavior Changes
39+
- `blur_active_element` defaults to `true`
40+
- `hide_caret` defaults to `true`
41+
- `fail_if_new` defaults to `true` in CI
42+
- SVN support removed
43+
- ActiveSupport no longer required
44+
45+
### Performance
46+
- Faster ChunkyPNG shift-detection (eliminated allocations)
47+
- Cached computations in VIPS driver
48+
- Memoized region area size
49+
50+
See [CHANGELOG.md](../CHANGELOG.md) for full details.

0 commit comments

Comments
 (0)