Skip to content

Commit

Permalink
Fix docs-preview pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
zzak committed Apr 19, 2024
1 parent 2995bb3 commit 370c20b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions pipelines/docs-preview/initial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ steps:
- artifacts#v1.9.3:
upload:
- .buildkite/.empty
- .buildkite/bin/docs-preview-annotate
- .buildkite/docker-compose.yml
- .buildkite/Dockerfile
- .buildkite/Dockerfile.beanstalkd
Expand Down
19 changes: 14 additions & 5 deletions pipelines/docs-preview/pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
build_context = context.extensions.find(Buildkite::Config::BuildContext)
build_context.ruby = Buildkite::Config::RubyConfig.new(prefix: "ruby:", version: Gem::Version.new("3.3"))

env CLOUDFLARE_PAGES_PROJECT: "rails-docs-preview"

command do
label "build", emoji: :rails
key "build"
Expand Down Expand Up @@ -40,6 +42,8 @@
plugin :docker, {
environment: [
"BUILDKITE_BRANCH",
"BUILDKITE_PTY=false",
"CLOUDFLARE_PAGES_PROJECT",
"CLOUDFLARE_ACCOUNT_ID",
"CLOUDFLARE_API_TOKEN",
# Turn off annoying prompt
Expand All @@ -51,15 +55,20 @@
plugin :artifacts, {
download: "preview.tar.gz"
}
command "tar -xzf preview.tar.gz"
command "npm install wrangler"
command "npx wrangler pages publish preview --project-name=$CLOUDFLARE_PAGES_PROJECT --branch=\"$BUILDKITE_BRANCH\""
command "tar -xzf preview.tar.gz;"
command "echo \"[wrangler] pages deploy preview: $$CLOUDFLARE_PAGES_PROJECT\";"
command "npm install wrangler@3;"
command "npx wrangler@3 pages project create \"$$CLOUDFLARE_PAGES_PROJECT\" --production-branch=\"main\" || true;"
command "npx wrangler@3 pages deploy preview --project-name=\"$$CLOUDFLARE_PAGES_PROJECT\" --branch=\"$BUILDKITE_BRANCH\";"
end

command do
label "annotate", emoji: :writing_hand
depends_on "deploy"
plugin :artifacts, { download: ".buildkite/docs-preview-annotate" }
plugin :artifacts, {
download: ".buildkite/bin/docs-preview-annotate",
compressed: ".buildkite.tgz"
}
command "sh -c \"$$ANNOTATE_COMMAND\" | buildkite-agent annotate --style info"
env "ANNOTATE_COMMAND" => <<~ANNOTATE.gsub(/[[:space:]]+/, " ").strip
docker run --rm
Expand All @@ -68,7 +77,7 @@
-e CLOUDFLARE_API_TOKEN
-e CLOUDFLARE_PAGES_PROJECT
ruby:latest
ruby .buildkite/docs-preview-annotate
ruby .buildkite/bin/docs-preview-annotate
ANNOTATE
end
end

0 comments on commit 370c20b

Please sign in to comment.