diff --git a/.github/workflows/build_for_github_package.yml b/.github/workflows/build_for_github_package.yml index 537eb931..b4edc6e0 100644 --- a/.github/workflows/build_for_github_package.yml +++ b/.github/workflows/build_for_github_package.yml @@ -43,6 +43,7 @@ jobs: mkdir ~/.gem echo -e "---\n:github: Bearer $GITHUB_SECRET_TOKEN" >> ~/.gem/credentials chmod 0600 ~/.gem/credentials - bundle exec rake build_gem_push_to_github_package[${{ steps.version.outputs.gem_version }}] + bundle exec rake build_gem_for_github_package[${{ steps.version.outputs.gem_version }}] + bundle exec rake push_gem_to_github_package[${{ steps.version.outputs.gem_version }}] env: GITHUB_SECRET_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Rakefile b/Rakefile index c3abe1b0..a8aa0920 100755 --- a/Rakefile +++ b/Rakefile @@ -385,14 +385,17 @@ end # need set the credentials under ~/.gem/credentials # for download, easiest way is to set BUNDLE_RUBYGEMS__PKG__GITHUB__COM # but there are other auth methods. see more on https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry -desc 'Build gem and push to github package. Run as bundle exec rake build_gem_push_to_github_package[]' -task :build_gem_push_to_github_package, [:version] do |_, args| - gem_to_push = find_or_build_gem(args[:version]) - gem_to_push.gsub!('builds/','') - exit 1 unless system('gem', 'push', '--key', 'github', '--host', 'https://rubygems.pkg.github.com/solarwinds', gem_to_push) +desc 'Push to github package. Run as bundle exec rake build_gem_push_to_github_package[]' +task :push_gem_to_github_package, [:version] do |_, args| + exit 1 unless system('gem', 'push', '--key', 'github', '--host', 'https://rubygems.pkg.github.com/solarwinds', "builds/#{args[:version]}.gem") puts "\n=== Finished ===\n" end +desc 'Build gem for github package' +task :build_gem_for_github_package, [:version] do |_, args| + gem_to_push = find_or_build_gem(args[:version]) +end + desc 'Run rubocop and generate result. Run as bundle exec rake rubocop If want to safely autocorrect enabled, just use bundle exec rake rubocop auto-safe If want to all autocorrect enabled, just use bundle exec rake rubocop auto-all