Skip to content

dep: update to Tailwind CSS v4.0.6 #59

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

Merged
merged 2 commits into from
Feb 10, 2025
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# tailwindcss-ruby changelog

## v4.0.6

* Update to [Tailwind CSS v4.0.6](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.6) @flavorjones

Upgrade guide at https://tailwindcss.com/docs/upgrade-guide


## v4.0.5

* Update to [Tailwind CSS v4.0.5](https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.5) @flavorjones
Expand Down
18 changes: 12 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ This doc is a brief introduction on modifying and maintaining this gem.

## Updating to the latest upstream tailwindcss version

Update `lib/tailwindcss/ruby/upstream.rb` with the upstream version.
Please don't submit PRs to the maintainer with an upstream bump.

Run `bundle exec rake clobber` then `bundle exec rake download` to ensure the tailwindcss binaries can be downloaded, and that you have the correct versions on local disk.
- [ ] run `bin/bump-upstream`
- [ ] push the branch, create a PR

## Cutting a release of tailwindcss-ruby

- bump the version
- if it's just bumping the upstream:
- [ ] follow the steps above
- [ ] when the PR is green, merge the PR
- [ ] create a git tag (after updating local `main`)
- else if the gem is being changed in some other way:
- [ ] update `lib/tailwindcss/ruby/version.rb`
- [ ] update `CHANGELOG.md`
- [ ] commit and create a git tag
- [ ] `git commit`
- [ ] `git tag`
- build the native gems:
- [ ] `bundle exec rake clobber` if needed to clean up possibly-old tailwindcss executables
- [ ] `bundle exec rake clobber` (if needed to clean up old tailwindcss executables)
- [ ] `bundle exec rake package`
- push
- push source and gems:
- [ ] `for g in pkg/*.gem ; do gem push $g ; done`
- [ ] `git push && git push --tags`
- announce
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
tailwindcss-ruby (4.0.5)
tailwindcss-ruby (4.0.6)

GEM
remote: https://rubygems.org/
Expand Down
99 changes: 99 additions & 0 deletions bin/bump-upstream
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/usr/bin/env bash

set -eu
set -o pipefail

if [[ $# -lt 1 ]] ; then
echo "Usage: $(basename $0) <upstream-tag>"
echo
echo "Where <upstream_version> is the tag name of the Tailwind CSS release."
exit 1
fi

PAGER="" # we don't want gh to use a pager
git_cmd=$(command -v git)
gh_cmd=$(command -v gh)
sed_cmd=$(command -v sed)

fail() {
echo "Error: $*" >&2
exit 1
}

upstream_tag=$1
gem_version=$(echo $upstream_tag | $sed_cmd -E 's/^v//' | sed -E 's/-/./')
gem_tag="v${gem_version}"

github_user=$($git_cmd config github.user || true)
if [[ -z "$github_user" ]]; then
fail "github.user is not set in git config"
fi

# view the release. will fail if the release does not exist
$gh_cmd release view ${upstream_tag} --repo tailwindlabs/tailwindcss

# get on the right starting branch
if [[ -n "$($git_cmd status --porcelain --untracked-files=no)" ]]; then
fail "found uncommitted changes"
fi

if [[ $upstream_tag =~ ^v4 ]] ; then
base_branch="v4.x"

changelog_extra=$(cat <<EOF

Upgrade guide at https://tailwindcss.com/docs/upgrade-guide
EOF
)
elif [[ $upstream_tag =~ ^v3 ]] ; then
base_branch="main"
changelog_extra=""
else
fail "Whoa! A new major version? Need to update the ${0} script."
fi

$git_cmd switch $base_branch

if ! $git_cmd rev-parse --abbrev-ref @{push} >/dev/null 2>&1; then
fail "current branch is not tracking a remote branch"
fi

#
# modify the upstream version and gem version
#
$sed_cmd -E -i "s/^(\s+)VERSION\s+=.*/\1VERSION = \"${upstream_tag}\"/" lib/tailwindcss/ruby/upstream.rb
$sed_cmd -E -i "s/^(\s+)VERSION\s+=.*/\1VERSION = \"${gem_version}\"/" lib/tailwindcss/ruby/version.rb

bundle install

#
# modify the changelog
#
replacement_text=$(cat <<EOF
## ${gem_tag}

* Update to [Tailwind CSS ${upstream_tag}](https://github.com/tailwindlabs/tailwindcss/releases/tag/${upstream_tag}) @${github_user}
${changelog_extra}
EOF
)
# substitute newlines with '\n' so sed will do the right things
replacement_text=$(echo "$replacement_text" | tr '\n' '\t' | sed -E 's/\t/\\n/g')
$sed_cmd -E -i "0,/^##/{s|^##|${replacement_text}\n\n##|}" CHANGELOG.md

#
# check if the packages match the checksums
#
bundle exec rake clobber download

#
# commit to a branch
#
git switch -c flavorjones-dep-tailwindcss-${upstream_tag}
git add lib CHANGELOG.md Gemfile*
git commit -m "dep: update to Tailwind CSS ${upstream_tag}

https://github.com/tailwindlabs/tailwindcss/releases/tag/${upstream_tag}
"

echo "Now push the current branch and create a PR."
exit 0
2 changes: 1 addition & 1 deletion lib/tailwindcss/ruby/upstream.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Tailwindcss
module Ruby
module Upstream
VERSION = "v4.0.5"
VERSION = "v4.0.6"

# rubygems platform name => upstream release filename
NATIVE_PLATFORMS = {
Expand Down
2 changes: 1 addition & 1 deletion lib/tailwindcss/ruby/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Tailwindcss
module Ruby
VERSION = "4.0.5"
VERSION = "4.0.6"
end
end