rm -rf old dir when building docs & fix branch generation

This commit is contained in:
Donovan Daniels 2024-05-03 23:35:08 -05:00
parent 709bdda97b
commit 02c2c42d49
Signed by: Donovan_DMC
GPG Key ID: 907D29CBFD6157BA
2 changed files with 3 additions and 2 deletions

View File

@ -7,8 +7,8 @@ module OceanicWs
def github_push(payload)
if payload[:ref].starts_with?("refs/tags/")
BuildOceanicDocsJob.perform_later(:tag, payload)
elsif payload[:ref] == "refs/heads/dev"
BuildOceanicDocsJob.perform_later(:dev, payload)
elsif payload[:ref].starts_with?("refs/heads/")
BuildOceanicDocsJob.perform_later(:branch, payload)
end
head(204)

View File

@ -15,6 +15,7 @@ class BuildOceanicDocsJob < ApplicationJob
FileUtils.rm("#{dir}/.npmrc")
system("npx pnpm install --ignore-scripts --frozen-lockfile", exception: true)
system("npx pnpm run test:docs", exception: true)
FileUtils.rm_rf("/data/oceanic-docs/#{name}")
FileUtils.cp_r("#{dir}/docs", "/data/oceanic-docs/#{name}")
Cache.redis.sadd("oceanic:versions", name)
end