diff --git a/app/controllers/oceanic_ws/github_webhooks_controller.rb b/app/controllers/oceanic_ws/github_webhooks_controller.rb index e2beca0..16d715f 100644 --- a/app/controllers/oceanic_ws/github_webhooks_controller.rb +++ b/app/controllers/oceanic_ws/github_webhooks_controller.rb @@ -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) diff --git a/app/jobs/build_oceanic_docs_job.rb b/app/jobs/build_oceanic_docs_job.rb index 87d742f..11140ab 100644 --- a/app/jobs/build_oceanic_docs_job.rb +++ b/app/jobs/build_oceanic_docs_job.rb @@ -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