Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: Blueprint 5.1.0 #526

Closed
Closed
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
17 changes: 11 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- The `accessibilityIdentifier` can now be set on `AttributedLabel`.

### Removed

### Changed
Expand All @@ -27,7 +25,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Internal

# Past Releases
## [5.1.0] - 2024-11-25

### Added

- The `accessibilityIdentifier` can now be set on `AttributedLabel`.

### Internal

- Added release and changelog managements scripts to streamline releases.

## [5.0.1] - 2024-11-04

Expand Down Expand Up @@ -116,8 +122,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `AccessibilityElement` now supports providing arbitrary strings to assistive devices using the `AXCustomContent` protocol.

### Removed

### Changed

- The behavior of `name` of `ElementPreview` has been change, affecting the SwiftUI `previewName`. Instead of including device or size information (i.e. `sizeThatFits - \(name)`), it now either defaults to the Xcode default if given an empty string, and shows _only_ the `name` if `name` is non-empty.
Expand Down Expand Up @@ -1135,7 +1139,7 @@ searchField

- First stable release.

[main]: https://github.com/square/Blueprint/compare/5.0.1...HEAD
[main]: https://github.com/square/Blueprint/compare/5.1.0...HEAD
[5.0.1]: https://github.com/square/Blueprint/compare/5.0.0...5.0.1
[5.0.0]: https://github.com/square/Blueprint/compare/4.3.0...5.0.0
[4.3.0]: https://github.com/square/Blueprint/compare/4.2.1...4.3.0
Expand Down Expand Up @@ -1273,3 +1277,4 @@ searchField
[#19]: https://github.com/square/Blueprint/pull/19
[#18]: https://github.com/square/Blueprint/pull/18
[#15]: https://github.com/square/Blueprint/pull/15
[5.1.0]: https://github.com/square/Blueprint/compare/5.0.1...5.1.0
16 changes: 15 additions & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Releasing a new version

1. Prepare a release

```
# Cuts a release off of main with the given version number.
Scripts/release.sh --version 1.2.3
```

Manual instructions can be found here:

<details>

1. You must be listed as an owner of the pods `BlueprintUI` and `BlueprintUICommonControls`.

To check this run:
Expand All @@ -17,7 +28,7 @@

1. Update the library version in `version.rb` if it has not already been updated (it should match the version number that you are about to release).

1. Update `CHANGELOG.md` (in the root of the repo), moving current changes under `Main` to a new section under `Past Releases` for the version you are releasing.
1. Update `CHANGELOG.md` (in the root of the repo), moving current changes under `Main` to a new section for the version you are releasing.

The changelog uses [reference links](https://daringfireball.net/projects/markdown/syntax#link) to link each version's changes. Remember to add a link to the new version at the bottom of the file, and to update the link to `[main]`.

Expand All @@ -32,6 +43,8 @@

1. Push your branch and open a PR into `main`.

</details>

1. Once the PR is merged, fetch changes and tag the release, using the merge commit:
```bash
git fetch
Expand All @@ -49,3 +62,4 @@
# version of BlueprintUI that we just published.
bundle exec pod trunk push --synchronous BlueprintUICommonControls.podspec
```

12 changes: 6 additions & 6 deletions SampleApp/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PODS:
- BlueprintUI (5.0.1)
- BlueprintUI/Tests (5.0.1)
- BlueprintUICommonControls (5.0.1):
- BlueprintUI (= 5.0.1)
- BlueprintUI (5.1.0)
- BlueprintUI/Tests (5.1.0)
- BlueprintUICommonControls (5.1.0):
- BlueprintUI (= 5.1.0)

DEPENDENCIES:
- BlueprintUI (from `../BlueprintUI.podspec`)
Expand All @@ -16,8 +16,8 @@ EXTERNAL SOURCES:
:path: "../BlueprintUICommonControls.podspec"

SPEC CHECKSUMS:
BlueprintUI: 8d6991d64adcd61b7421266ccad95b2a3a3ca656
BlueprintUICommonControls: 060db17f4b9b72920aa950e2dfbd7808840f4b52
BlueprintUI: 9ba3799699c813cf86165fc36e646bb10e7e5b47
BlueprintUICommonControls: 91307b32a90175365c389ef0a033c516bd56feb7

PODFILE CHECKSUM: 1cffac4623851f31dc42270ba99701e3825e6d67

Expand Down
93 changes: 93 additions & 0 deletions Scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/bash

set -euo pipefail

branch="main"
diff_check=false

# Function to display usage
usage() {
echo "Usage: $0 --version <version> [--branch <branch>] [--no-diff-check]"
exit 1
}

# Parse options
while [[ $# -gt 0 ]]; do
case $1 in
-v|--version) version="$2"; shift 2 ;;
-b|--branch) branch="$2"; shift 2 ;;
-n|--no-diff-check) diff_check=false; shift ;;
--) shift; break ;;
-*|--*) echo "Unknown option $1"; usage ;;
*) break ;;
esac
done

# Check if version argument is provided
if [ -z "${version:-}" ]; then
echo "Error: You must provide a version number."
usage
fi

# Ensure there are no unstaged changes
if [ "$diff_check" = true ] && ! git diff --quiet origin/"$branch"; then
echo "Error: This branch has differences compared to origin/$branch. Please push or undo these changes before continuing."
echo "You can bypass this check with the --no-diff-check flag."
exit 1
fi

# This timestamp is used during branch creation.
# It's helpful in cases where the script fails and a new branch needs to
# be created on a subsequent attempt.
timestamp=$(date +"%Y-%m-%d-%H_%M_%S")

git checkout "$branch"
git pull

# Create a new branch with the version and timestamp
branch_name="$(whoami)/release-$version-$timestamp"
git checkout -b "$branch_name"

# Define the git repo root
repo_root=$(git rev-parse --show-toplevel)

# Extract the previous version number from version.rb
previous_version=$(grep 'BLUEPRINT_VERSION' "$repo_root/version.rb" | awk -F"'" '{print $2}')

# Update the library version in version.rb
sed -i '' "s/BLUEPRINT_VERSION ||= .*/BLUEPRINT_VERSION ||= '$version'/" "$repo_root/version.rb"

# Update CHANGELOG.md using stamp-changelog.sh
"$repo_root/Scripts/stamp-changelog.sh" --version "$version" --previous-version "$previous_version"

# Change directory into the SampleApp dir and update Podfile.lock using a subshell
(
cd "$repo_root/SampleApp"
bundle exec pod install
)

# Commit the changes
git add .
git commit -m "Bumping versions to $version."

# Push the branch and open a PR into main
git push origin "$branch_name"

gh pr create --draft --title "release: Blueprint $version" --body "https://github.com/square/Blueprint/blob/main/CHANGELOG.md"

gh pr view --web

echo "Branch $branch_name created and pushed. A draft PR has been created."

# Instructions for tagging and publishing the release
echo ""
echo "Next steps:"
echo ""
echo "Once the PR is merged, fetch changes and tag the release, using the merge commit:"
echo " git fetch"
echo " git tag $version <merge commit SHA>"
echo " git push origin $version"
echo ""
echo "Publish to CocoaPods:"
echo " bundle exec pod trunk push BlueprintUI.podspec"
echo " bundle exec pod trunk push --synchronous BlueprintUICommonControls.podspec"
79 changes: 79 additions & 0 deletions Scripts/stamp-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

# Function to display usage
usage() {
echo "Usage: $0 -v <version> -p <previous-version>"
echo " -v, --version Version number (required)"
echo " -p, --previous-version Previous version number (required)"
echo " -d, --release-date The date of the release (optional). Defaults to: date +%Y-%m-%d"
exit 1
}

# Parse options
while [[ "$#" -gt 0 ]]; do
case "$1" in
-v|--version) version="$2"; shift 2 ;;
-p|--previous-version) previous_version="$2"; shift 2 ;;
-d|--release-date) release_date="$2"; shift 2 ;;
--) shift; break ;;
-*|--*) echo "Unknown option $1"; usage ;;
*) break ;;
esac
done

# Check if both version and previous_version arguments are provided
if [ -z "$version" ] || [ -z "$previous_version" ]; then
echo "Error: You must provide both version and previous version numbers."
usage
fi

if [ -z "$release_date" ]; then
release_date=$(date +%Y-%m-%d)
fi

repo_root=$(git rev-parse --show-toplevel)
changelog_file="$repo_root/CHANGELOG.md"

changelog=$(ruby <<EOF
changelog_contents = File.read('$changelog_file')
changelog_contents.gsub!(/(###.*\n\n)+#/, '#')
puts changelog_contents
EOF
)

# Define the changelog template
unreleased_changelog_template="## [Main]\n\
\n\
### Fixed\n\
\n\
### Added\n\
\n\
### Removed\n\
\n\
### Changed\n\
\n\
### Deprecated\n\
\n\
### Security\n\
\n\
### Documentation\n\
\n\
### Misc\n\
\n\
### Internal\n\
\n\
## [$version] - $release_date"

# Replace the Main section with the new template
changelog=$(echo "$changelog" | sed "s/^## \[Main\]/$unreleased_changelog_template/")

# Replace the line starting with "[main]: " to the new URL
changelog=$(echo "$changelog" | sed "s|^\[main\]: .*|\[main\]: https://github.com/square/Blueprint/compare/$version...HEAD|")

# Append the new version comparison link at the end of the file
changelog="$changelog"$'\n'"[$version]: https://github.com/square/Blueprint/compare/$previous_version...$version"

# Write the updated contents back to the changelog file
echo "$changelog" > "$changelog_file"

echo "CHANGELOG.md updated for version $version."
2 changes: 1 addition & 1 deletion version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

BLUEPRINT_VERSION ||= '5.0.1'
BLUEPRINT_VERSION ||= '5.1.0'

SWIFT_VERSION ||= File.read(File.join(__dir__, '.swift-version'))

Expand Down
Loading