From e3296a0e740dbd63ed7511a9eff3b547c4353452 Mon Sep 17 00:00:00 2001 From: aaroncastro1990 Date: Fri, 12 Apr 2024 12:49:01 -0600 Subject: [PATCH] using two targets for middleman config --- .github/workflows/build.yaml | 2 +- config.rb | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d3391e34..4904b0a6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -97,7 +97,7 @@ jobs: gem update --system 3.2.3 echo "Pull Request: $TRAVIS_PULL_REQUEST" # Ensure the site builds, otherwise fail the build on PRs - if [[ $CI_NODE_INDEX = "build" && $TRAVIS_PULL_REQUEST != 'false' ]]; then bundle exec rake download_policy_list; bundle exec middleman build; fi + if [[ $CI_NODE_INDEX = "build" && $TRAVIS_PULL_REQUEST != 'false' ]]; then bundle exec rake download_policy_list; TARGET="test" bundle exec middleman deploy; fi # Ensure the links work, otherwise fail the build on PRs (only on PRs) if [[ $CI_NODE_INDEX = "check_links" && $TRAVIS_PULL_REQUEST != 'false' ]]; then echo "TODO Fix check_links to throttle itself properly"; fi # Only deploy the site live if the master branch is updated (not during pull-requests) diff --git a/config.rb b/config.rb index 934434b0..e832cc07 100644 --- a/config.rb +++ b/config.rb @@ -264,15 +264,27 @@ def image(link, title, alt_text) end # middleman-deploy configuration -activate :deploy do |deploy| - # Automatically run `middleman build` during `middleman deploy` - deploy.build_before = true - - # rsync, ftp, sftp, or git - deploy.method = :git +case ENV['TARGET'].to_s.downcase +when 'test' + activate :deploy do |deploy| + # Automatically run `middleman build` during `middleman deploy` + deploy.build_before = true + + # rsync, ftp, sftp, or git + deploy.method = :git + deploy.branch = "test-gh-pages" + end +else + activate :deploy do |deploy| + # Automatically run `middleman build` during `middleman deploy` + deploy.build_before = true + # rsync, ftp, sftp, or git + deploy.method = :git + end end + page "/release-feed.xml", :layout => false # Activate middleman-breadcrumb gem