Fix version handling in CI for old docs
This MR fixes (attempts to fix) the handling of the versions when building the old docs.
The old way used after_script
which doesn't have access to variables defined in the before_script
section, so it didn't work.