Fix old version cleanup to sort by modified date

I was sorting by version name, which _was_ reliable until I changed my version name format, and then a deploy cleaned up the version it had just deployed because it no longer sorted to the end!

Rather than be dependent on a stable version name format, and set myself up for more surprises, I'm going to instead use the folder's modified time. While there could be surprising ways for folder timestamps to be updated, I expect it to be _more_ reliable overall.
This commit is contained in:
Emi Matchu 2021-11-02 21:16:46 -07:00
parent bddcf91c02
commit c13114b0cc

View file

@ -57,10 +57,10 @@
cmd: yarn install
- name: Find older versions to clean up
# Print out all but the last 5 versions
# Print out all but the 5 last-recently-updated versions
command:
chdir: /srv/impress-2020/versions
cmd: bash -c 'ls | head -n -5'
cmd: bash -c 'ls -t | tail -n +6'
register: versions_to_clean_up
- name: Clean up older versions