Update both hidden.json and snapshots.json (#8513)

* Update both hidden.json and snapshots.json

The assistant relies on the latter, our docs cronjob on the former. I
have no idea why we have two but keeping them in sync should be fine.

changelog_begin
changelog_end

* maybe I should test if my code compiles before pushing

changelog_begin
changelog_end
This commit is contained in:
Moritz Kiefer 2021-01-14 19:07:35 +01:00 committed by GitHub
parent 867041ce61
commit dfc48a0010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,13 +136,15 @@ fetch_if_missing opts temp v = do
update_s3 :: DocOptions -> FilePath -> Versions -> IO ()
update_s3 opts temp vs = do
putStrLn "Updating versions.json, hidden.json, latest..."
putStrLn "Updating versions.json, hidden.json, snapshots.json, latest..."
create_versions_json (dropdown vs) (temp </> "versions.json")
let hidden = Data.List.sortOn Data.Ord.Down $ Set.toList $ all_versions vs `Set.difference` (Set.fromList $ dropdown vs)
create_versions_json hidden (temp </> "hidden.json")
let push f = proc_ ["aws", "s3", "cp", temp </> f, s3Path opts f, "--acl", "public-read"]
let hiddenVersionFiles = ["hidden.json", "snapshots.json"]
Data.Foldable.for_ hiddenVersionFiles $ \f -> do
create_versions_json hidden (temp </> f)
push f
push "versions.json"
push "hidden.json"
Control.Monad.Extra.whenJust (top vs) $ \latest -> do
writeFile (temp </> "latest") (show latest)
push "latest"