Skip to content

Commit

Permalink
generated credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
juliocabrera820 committed May 4, 2024
1 parent 87afc94 commit a8a5b78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions credentials.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
require 'fileutils'

require_relative 'inputs'
require_relative 'credentials'

# Module to handle credentials
module Credentials
def self.generate_gh_credentials
print "github token: #{Inputs::GITHUB_TOKEN}"
credentials = <<~CREDENTIALS
---
:github: Bearer #{Inputs::GITHUB_TOKEN}
Expand All @@ -15,6 +17,7 @@ def self.generate_gh_credentials
end

def self.generate_rubygems_credentials
print "rubygems: #{Inputs::RUBYGEMS_API_KEY}"
credentials = <<~CREDENTIALS
---
:rubygems_api_key: #{Inputs::RUBYGEMS_API_KEY}
Expand All @@ -32,6 +35,7 @@ def self.write_credentials(credentials)

def self.delete_credentials_file_path
credentials_file_path = "#{Dir.home}/.gem/credentials"
CommandSystem.run_command('cat', credentials_file_path)
FileUtils.rm(credentials_file_path) if File.exist?(credentials_file_path)
end
end
2 changes: 1 addition & 1 deletion main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
Publish.to_rubygems unless Inputs::RUBYGEMS_API_KEY.nil?
Publish.to_github_packages unless Inputs::GITHUB_TOKEN.nil?
ensure
Credentials.delete_credentials_file_path
# Credentials.delete_credentials_file_path
end

0 comments on commit a8a5b78

Please sign in to comment.