Skip to content

Commit

Permalink
chore: set branch when publishing pacts and remove publishing to old …
Browse files Browse the repository at this point in the history
…pactflow account
  • Loading branch information
bethesque committed Feb 19, 2024
1 parent 9b1e606 commit 9aaa0dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ jobs:
ruby-version: "3.2"
- run: "bundle install"
# Publish to old and new account until we can disable the old account
- run: |
- name: Generate and publish pacts
run: |
rm -rf spec/pacts/*
bundle exec rspec spec/service_providers/
VERBOSE=true bundle exec rake pact:publish:pactflow_oss
VERBOSE=true bundle exec rake pact:publish:pactflow_pact_foundation
bundle exec rake pact:publish:pactflow_pact_foundation
env:
PACT_BROKER_TOKEN: ${{ secrets.PACTFLOW_PACT_OSS_TOKEN }}
PACT_BROKER_TOKEN_PACT_FOUNDATION: ${{ secrets.PACT_BROKER_TOKEN_PACT_FOUNDATION }}
PACT_BROKER_FEATURES: ${{ matrix.feature }}
TEST_FEATURE: ${{ matrix.feature }}
Expand Down
22 changes: 1 addition & 21 deletions tasks/pact.rake
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,6 @@ PactBroker::Client::PublicationTask.new(:remote) do | task |
task.pact_broker_basic_auth = { username: ENV.fetch("PACT_BROKER_USERNAME"), password: ENV.fetch("PACT_BROKER_PASSWORD") }
end

PactBroker::Client::PublicationTask.new(:pactflow_oss) do | task |
version = ENV.fetch("GITHUB_SHA")
branch = ENV.fetch("GITHUB_REF").gsub("refs/heads/", "")
feature = ENV.fetch("TEST_FEATURE", "")
tag = branch

if feature != ''
version = "#{version}+#{feature}"
tag = "#{tag}+#{feature}"
end

require "pact_broker/client/version"
task.auto_detect_version_properties = false
task.tags = [tag]
task.branch = nil
task.consumer_version = version
task.pact_broker_base_url = "https://pact-oss.pactflow.io"
task.pact_broker_token = ENV['PACT_BROKER_TOKEN']
task.build_url = PactBroker::Client::Git.build_url
end

PactBroker::Client::PublicationTask.new(:pactflow_pact_foundation) do | task |
version = ENV.fetch("GITHUB_SHA")
Expand All @@ -53,7 +33,7 @@ PactBroker::Client::PublicationTask.new(:pactflow_pact_foundation) do | task |
require "pact_broker/client/version"
task.auto_detect_version_properties = false
task.tags = [tag]
task.branch = nil
task.branch = branch
task.consumer_version = version
task.pact_broker_base_url = "https://pact-foundation.pactflow.io"
task.pact_broker_token = ENV["PACT_BROKER_TOKEN_PACT_FOUNDATION"]
Expand Down

0 comments on commit 9aaa0dd

Please sign in to comment.