-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: open
deploy
to take package-names
- Loading branch information
1 parent
3619c94
commit 24471e2
Showing
12 changed files
with
155 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
require_relative "./lib/deployer" | ||
|
||
config = | ||
Deployer::Config.new( | ||
github_token: ENV["GITHUB_TOKEN"], | ||
package_name: ENV["PACKAGE_NAME"], | ||
version: ENV["PACKAGE_VERSION"], | ||
owner: ENV["OWNER"], | ||
only: ENV["ONLY"].split(","), | ||
automerge: ENV["AUTOMERGE"] == "true", | ||
upgrade_commands: JSON.parse(ENV["UPGRADE_COMMANDS"]), | ||
branch_name: ENV["BRANCH_NAME"], | ||
change_method: ENV["CHANGE_METHOD"], | ||
include: ENV["INCLUDE"].split(","), | ||
exclude: ENV["EXCLUDE"].split(","), | ||
allow_major: ENV["ALLOW_MAJOR"] == "true" | ||
) | ||
reporter = Deployer.new(config).run | ||
COMMON_CONFIG = { | ||
github_token: ENV["GITHUB_TOKEN"], | ||
version: ENV["PACKAGE_VERSION"], | ||
owner: ENV["OWNER"], | ||
only: ENV["ONLY"].split(","), | ||
automerge: ENV["AUTOMERGE"] == "true", | ||
upgrade_commands: JSON.parse(ENV["UPGRADE_COMMANDS"]), | ||
branch_name: ENV["BRANCH_NAME"], | ||
change_method: ENV["CHANGE_METHOD"], | ||
include: ENV["INCLUDE"].split(","), | ||
exclude: ENV["EXCLUDE"].split(","), | ||
allow_major: ENV["ALLOW_MAJOR"] == "true" | ||
} | ||
|
||
reporter.output_to_github | ||
def run_for_packages | ||
config = Deployer::Config.new(**COMMON_CONFIG, package_names: package_names) | ||
reporter = Deployer.new(config).run | ||
reporter.output_to_github | ||
end | ||
|
||
def package_names | ||
return ENV["PACKAGE_NAMES"].split(",") if ENV["PACKAGE_NAMES"] | ||
|
||
[ENV["PACKAGE_NAME"]] | ||
end | ||
|
||
run_for_packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,10 @@ | |
instance_double( | ||
Deployer::Config, | ||
version: "1.0.1", | ||
package_name: "test" | ||
package_names: ["test"] | ||
) | ||
updater = described_class.new("test", config: config) | ||
updater = | ||
described_class.new("repo", config: config, package_name: "test") | ||
allow(File).to receive(:exist?).and_return(true) | ||
allow(YAML).to receive(:load_file).and_return( | ||
"upgrade_command" => | ||
|
@@ -27,11 +28,12 @@ | |
instance_double( | ||
Deployer::Config, | ||
version: "1.0.1", | ||
package_name: "test", | ||
package_names: ["test"], | ||
upgrade_commands: { | ||
} | ||
) | ||
updater = described_class.new("test", config: config) | ||
updater = | ||
described_class.new("repo", config: config, package_name: "test") | ||
allow(File).to receive(:exist?).and_return(true) | ||
allow(YAML).to receive(:load_file).and_return({}) | ||
|
||
|
@@ -45,12 +47,13 @@ | |
instance_double( | ||
Deployer::Config, | ||
version: "1.0.1", | ||
package_name: "test", | ||
package_names: ["test"], | ||
upgrade_commands: { | ||
"test" => "some other upgrade" | ||
"repo" => "some other upgrade" | ||
} | ||
) | ||
updater = described_class.new("test", config: config) | ||
updater = | ||
described_class.new("repo", config: config, package_name: "test") | ||
allow(File).to receive(:exist?).and_return(false) | ||
|
||
expect(updater.send(:upgrade_command)).to eq( | ||
|
@@ -65,12 +68,13 @@ | |
instance_double( | ||
Deployer::Config, | ||
version: "1.0.1", | ||
package_name: "test", | ||
package_names: ["test"], | ||
upgrade_commands: { | ||
"other" => "some other upgrade" | ||
} | ||
) | ||
updater = described_class.new("test", config: config) | ||
updater = | ||
described_class.new("repo", config: config, package_name: "test") | ||
allow(File).to receive(:exist?).and_return(false) | ||
|
||
expect(updater.send(:upgrade_command)).to eq("yarn upgrade [email protected]") | ||
|
Oops, something went wrong.