capistrano sets several useful variables, one of which is called latest_revision, which you can upload to a file.
task :mark_revision do
log = "#{deploy_to}/revisions.log"
run "(test -e #{log} || touch #{log} && chmod 666 #{log}) && " +
"echo #{latest_revision} >> #{log};"
end