From 9333e3ea643cc0ce76a5427d9fdb514acbfbb30b Mon Sep 17 00:00:00 2001 From: crespire Date: Mon, 4 May 2026 17:03:16 -0400 Subject: [PATCH 1/4] Bump Node, Ruby and gems --- .tool-versions | 4 ++-- Gemfile | 2 -- Gemfile.lock | 3 --- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.tool-versions b/.tool-versions index 55ad556..e0682e1 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -ruby 3.3.5 -node 20.9.0 +ruby 4.0.1 +nodejs 24.15.0 diff --git a/Gemfile b/Gemfile index 758bc3e..81e29b4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,5 @@ source 'https://rubygems.org' -ruby '3.3.5' - # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem 'rails', '~> 7.1.1' diff --git a/Gemfile.lock b/Gemfile.lock index 0a7f941..5b09714 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -288,8 +288,5 @@ DEPENDENCIES tzinfo-data web-console -RUBY VERSION - ruby 3.3.5p100 - BUNDLED WITH 4.0.5 From 84535eea8c17cf0b141860454bbf37b8a9f62a64 Mon Sep 17 00:00:00 2001 From: crespire Date: Mon, 4 May 2026 17:05:10 -0400 Subject: [PATCH 2/4] Update .ruby-version as well --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index fa7adc7..1454f6e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.5 +4.0.1 From dfb7c489f0a1f23e6897a6cbbebd5350cfd00335 Mon Sep 17 00:00:00 2001 From: crespire Date: Mon, 4 May 2026 17:07:29 -0400 Subject: [PATCH 3/4] Align all the versions --- .node-version | 2 +- .ruby-version | 2 +- .tool-versions | 2 +- Dockerfile | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.node-version b/.node-version index f3f52b4..5bf4400 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -20.9.0 +24.15.0 diff --git a/.ruby-version b/.ruby-version index 1454f6e..c4e41f9 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -4.0.1 +4.0.3 diff --git a/.tool-versions b/.tool-versions index e0682e1..cea3914 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -ruby 4.0.1 +ruby 4.0.3 nodejs 24.15.0 diff --git a/Dockerfile b/Dockerfile index 3030aeb..cbc541e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax = docker/dockerfile:1 # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.3.5 +ARG RUBY_VERSION=4.0.3 FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim AS base # Rails app lives here @@ -22,7 +22,7 @@ RUN apt-get update -qq && \ apt-get install --no-install-recommends -y build-essential curl git libpq-dev libvips node-gyp pkg-config python-is-python3 # Install JavaScript dependencies -ARG NODE_VERSION=20.9.0 +ARG NODE_VERSION=24.15.0 ENV PATH=/usr/local/node/bin:$PATH RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \ /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \ From f874d3b430661d89cc2ab759873465a6fb802f16 Mon Sep 17 00:00:00 2001 From: crespire Date: Mon, 4 May 2026 17:17:45 -0400 Subject: [PATCH 4/4] Add a version check and make Dockerfile read node from file --- .github/actions/check-versions/action.yml | 37 +++++++++++++++++++++++ .github/workflows/tests.yml | 3 ++ Dockerfile | 12 +++++--- 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 .github/actions/check-versions/action.yml diff --git a/.github/actions/check-versions/action.yml b/.github/actions/check-versions/action.yml new file mode 100644 index 0000000..6d719a7 --- /dev/null +++ b/.github/actions/check-versions/action.yml @@ -0,0 +1,37 @@ +name: 'Check version alignment' +description: 'Verify Ruby and Node versions agree across .ruby-version, .node-version, .tool-versions, and Dockerfile' + +runs: + using: 'composite' + steps: + - name: Verify language version alignment + shell: bash + run: | + set -eu + + ruby_version=$(tr -d '[:space:]' < .ruby-version) + node_version=$(tr -d '[:space:]' < .node-version) + + tool_ruby=$(awk '/^ruby[[:space:]]/ {print $2}' .tool-versions) + tool_node=$(awk '/^nodejs[[:space:]]/ {print $2}' .tool-versions) + + dockerfile_ruby=$(awk -F= '/^ARG RUBY_VERSION=/ {print $2}' Dockerfile) + + fail=0 + check() { + if [ "$2" != "$3" ]; then + echo "::error::$1 mismatch: expected '$2', got '$3'" + fail=1 + fi + } + + check ".tool-versions ruby vs .ruby-version" "$ruby_version" "$tool_ruby" + check "Dockerfile ARG RUBY_VERSION vs .ruby-version" "$ruby_version" "$dockerfile_ruby" + check ".tool-versions nodejs vs .node-version" "$node_version" "$tool_node" + + if [ $fail -ne 0 ]; then + echo "Version alignment failed. Source of truth: .ruby-version and .node-version." >&2 + exit 1 + fi + + echo "Versions aligned: ruby=$ruby_version, node=$node_version" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index de46fec..e79d08e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,6 +32,9 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Check version alignment + uses: ./.github/actions/check-versions + - name: Set up Ruby uses: ruby/setup-ruby@v1 with: diff --git a/Dockerfile b/Dockerfile index cbc541e..96e8fa9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ # syntax = docker/dockerfile:1 -# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile +# Source of truth for Ruby is .ruby-version. The CI "check-versions" action +# enforces that this ARG default stays aligned with it. ARG RUBY_VERSION=4.0.3 FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim AS base @@ -21,12 +22,13 @@ FROM base AS build RUN apt-get update -qq && \ apt-get install --no-install-recommends -y build-essential curl git libpq-dev libvips node-gyp pkg-config python-is-python3 -# Install JavaScript dependencies -ARG NODE_VERSION=24.15.0 +# Install JavaScript dependencies — Node version is read from .node-version +COPY .node-version /tmp/.node-version ENV PATH=/usr/local/node/bin:$PATH -RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \ +RUN NODE_VERSION="$(tr -d '[:space:]' < /tmp/.node-version)" && \ + curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \ /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \ - rm -rf /tmp/node-build-master + rm -rf /tmp/node-build-master /tmp/.node-version # Install application gems COPY Gemfile Gemfile.lock ./