From 0895c8e5ef99e5c9c2ea18606952435b2671c7e9 Mon Sep 17 00:00:00 2001 From: Hung Nguyen Date: Mon, 11 Mar 2024 11:35:50 +0700 Subject: [PATCH] DC-3240: Fixing failed update license file during release gem --- .github/workflows/build.yml | 16 ++++++++++------ Rakefile | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 780d0ba6c..eb9f7d370 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,9 +23,11 @@ jobs: key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - name: Run gem release - run: bundle exec rake gem:release - env: - GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} + run: | + mkdir -p ~/.gem + echo -e "---\n:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}" > ~/.gem/credentials + chmod 0600 ~/.gem/credentials + bundle exec rake gem:release rubygems-release: runs-on: ubuntu-latest steps: @@ -37,9 +39,11 @@ jobs: ruby-version: 3.2.1 bundler-cache: true - name: Run gem release - run: bundle exec rake gem:release - env: - GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} + run: | + mkdir -p ~/.gem + echo -e "---\n:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}" > ~/.gem/credentials + chmod 0600 ~/.gem/credentials + bundle exec rake gem:release gem-smoke-test: runs-on: ubuntu-latest needs: [jruby-gem-release, rubygems-release] diff --git a/Rakefile b/Rakefile index 393e87fc2..7ee7addc4 100644 --- a/Rakefile +++ b/Rakefile @@ -39,7 +39,7 @@ namespace :gem do File.delete(origin_license_file) if File.exist?(origin_license_file) File.delete(notices_file) if File.exist?(notices_file) puts "Deleted files: #{origin_license_file} and #{notices_file}" - File.rename(new_license_file, origin_license_file) if File.exists?(new_license_file) + File.rename(new_license_file, origin_license_file) if File.exist?(new_license_file) puts "Renamed file #{new_license_file} to #{origin_license_file}" puts "Building #{gem} ..." res = `gem build ./gooddata.gemspec`