| 1 | # Releasing |
| 2 | |
| 3 | To release a new version of Prism, perform the following steps: |
| 4 | |
| 5 | ## Preparation |
| 6 | |
| 7 | * Update the `CHANGELOG.md` file. |
| 8 | * Add a new section for the new version at the top of the file. |
| 9 | * Fill in the relevant changes — it may be easiest to click the link for the `Unreleased` heading to find the commits. |
| 10 | * Update the links at the bottom of the file. |
| 11 | * Update the version numbers in the various files that reference them: |
| 12 | |
| 13 | ```sh |
| 14 | export PRISM_MAJOR="x" |
| 15 | export PRISM_MINOR="y" |
| 16 | export PRISM_PATCH="z" |
| 17 | export PRISM_VERSION="$PRISM_MAJOR.$PRISM_MINOR.$PRISM_PATCH" |
| 18 | ruby -pi -e 'gsub(/spec\.version = ".+?"/, %Q{spec.version = "#{ENV["PRISM_VERSION"]}"})' prism.gemspec |
| 19 | ruby -pi -e 'gsub(/EXPECTED_PRISM_VERSION ".+?"/, %Q{EXPECTED_PRISM_VERSION "#{ENV["PRISM_VERSION"]}"})' ext/prism/extension.h |
| 20 | ruby -pi -e 'gsub(/PRISM_VERSION_MAJOR \d+/, %Q{PRISM_VERSION_MAJOR #{ENV["PRISM_MAJOR"]}})' include/prism/version.h |
| 21 | ruby -pi -e 'gsub(/PRISM_VERSION_MINOR \d+/, %Q{PRISM_VERSION_MINOR #{ENV["PRISM_MINOR"]}})' include/prism/version.h |
| 22 | ruby -pi -e 'gsub(/PRISM_VERSION_PATCH \d+/, %Q{PRISM_VERSION_PATCH #{ENV["PRISM_PATCH"]}})' include/prism/version.h |
| 23 | ruby -pi -e 'gsub(/PRISM_VERSION ".+?"/, %Q{PRISM_VERSION "#{ENV["PRISM_VERSION"]}"})' include/prism/version.h |
| 24 | ruby -pi -e 'gsub(/"version": ".+?"/, %Q{"version": "#{ENV["PRISM_VERSION"]}"})' javascript/package.json |
| 25 | ruby -pi -e 'gsub(/lossy\(\), ".+?"/, %Q{lossy(), "#{ENV["PRISM_VERSION"]}"})' rust/ruby-prism-sys/tests/utils_tests.rs |
| 26 | ruby -pi -e 'gsub(/\d+, "prism major/, %Q{#{ENV["PRISM_MAJOR"]}, "prism major})' templates/java/org/prism/Loader.java.erb |
| 27 | ruby -pi -e 'gsub(/\d+, "prism minor/, %Q{#{ENV["PRISM_MINOR"]}, "prism minor})' templates/java/org/prism/Loader.java.erb |
| 28 | ruby -pi -e 'gsub(/\d+, "prism patch/, %Q{#{ENV["PRISM_PATCH"]}, "prism patch})' templates/java/org/prism/Loader.java.erb |
| 29 | ruby -pi -e 'gsub(/MAJOR_VERSION = \d+/, %Q{MAJOR_VERSION = #{ENV["PRISM_MAJOR"]}})' templates/javascript/src/deserialize.js.erb |
| 30 | ruby -pi -e 'gsub(/MINOR_VERSION = \d+/, %Q{MINOR_VERSION = #{ENV["PRISM_MINOR"]}})' templates/javascript/src/deserialize.js.erb |
| 31 | ruby -pi -e 'gsub(/PATCH_VERSION = \d+/, %Q{PATCH_VERSION = #{ENV["PRISM_PATCH"]}})' templates/javascript/src/deserialize.js.erb |
| 32 | ruby -pi -e 'gsub(/MAJOR_VERSION = \d+/, %Q{MAJOR_VERSION = #{ENV["PRISM_MAJOR"]}})' templates/lib/prism/serialize.rb.erb |
| 33 | ruby -pi -e 'gsub(/MINOR_VERSION = \d+/, %Q{MINOR_VERSION = #{ENV["PRISM_MINOR"]}})' templates/lib/prism/serialize.rb.erb |
| 34 | ruby -pi -e 'gsub(/PATCH_VERSION = \d+/, %Q{PATCH_VERSION = #{ENV["PRISM_PATCH"]}})' templates/lib/prism/serialize.rb.erb |
| 35 | ruby -pi -e 'gsub(/^version = ".+?"/, %Q{version = "#{ENV["PRISM_VERSION"]}"})' rust/ruby-prism-sys/Cargo.toml |
| 36 | ruby -pi -e 'gsub(/^version = ".+?"/, %Q{version = "#{ENV["PRISM_VERSION"]}"})' rust/ruby-prism/Cargo.toml |
| 37 | ruby -pi -e 'gsub(/^ruby-prism-sys = \{ version = ".+?"/, %Q{ruby-prism-sys = \{ version = "#{ENV["PRISM_VERSION"]}"})' rust/ruby-prism/Cargo.toml |
| 38 | ``` |
| 39 | |
| 40 | * Update the `Gemfile.lock` file: |
| 41 | |
| 42 | ```sh |
| 43 | chruby ruby-4.0.0-dev |
| 44 | bundle install |
| 45 | ``` |
| 46 | |
| 47 | * Update the version-specific lockfiles: |
| 48 | |
| 49 | ```sh |
| 50 | for VERSION in "2.7" "3.0" "3.1" "3.2" "3.3" "3.4" "4.0"; do docker run -it --rm -v "$PWD":/usr/src/app -w /usr/src/app -e BUNDLE_GEMFILE="gemfiles/$VERSION/Gemfile" "ruby:$VERSION" bundle update; done |
| 51 | chruby ruby-4.1.0-dev && BUNDLE_GEMFILE=gemfiles/4.1/Gemfile bundle install |
| 52 | ``` |
| 53 | |
| 54 | * Update the cargo lockfiles: |
| 55 | |
| 56 | ```sh |
| 57 | bundle exec rake cargo:build |
| 58 | ``` |
| 59 | |
| 60 | * Commit all of the updated files: |
| 61 | |
| 62 | ```sh |
| 63 | git commit -am "Bump to v$PRISM_VERSION" |
| 64 | ``` |
| 65 | |
| 66 | * Push up the changes: |
| 67 | |
| 68 | ```sh |
| 69 | git push |
| 70 | ``` |
| 71 | |
| 72 | ## Publishing |
| 73 | |
| 74 | * Update the GitHub release page with a copy of the latest entry in the `CHANGELOG.md` file. |
| 75 | * Push a new tag to the GitHub repository, following the `vX.Y.Z` format. |