diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d9ffe42..ac5125c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -19,6 +19,11 @@ jobs: ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }} runs-on: windows-latest steps: + - name: git config + run: | + git config --global core.autocrlf false + git config --global core.eol lf + git config --global advice.detachedHead 0 - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 @@ -28,3 +33,19 @@ jobs: - name: Run test run: bundle exec rake + - id: build + run: | + bundle exec rake build + echo "pkg=${GITHUB_REPOSITORY#*/}" >> $GITHUB_OUTPUT + if: >- + ${{ + github.event_name == 'push' && + (matrix.ruby == needs.ruby-versions.outputs.latest) + }} + shell: bash + - name: Upload package + uses: actions/upload-artifact@v4 + with: + path: pkg/*.gem + name: ${{steps.build.outputs.pkg}} + if: steps.build.outputs.pkg diff --git a/win32ole.gemspec b/win32ole.gemspec index 9c137a5..e9abb57 100644 --- a/win32ole.gemspec +++ b/win32ole.gemspec @@ -23,9 +23,11 @@ Gem::Specification.new do |spec| spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = spec.homepage - spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do - `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - end + cmd = %W[git ls-files -z -- + :^#{File.basename(__FILE__)} + :^/bin/ :^/test/ :^/rakelib/ :^/.git* :^Gemfile* :^Rakefile* + ] + spec.files = IO.popen(cmd, chdir: __dir__, err: IO::NULL, exception: false, &:read).split("\x0") spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"]