diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9a1cbdf..f62b8b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,3 +26,16 @@ jobs: bundler-cache: true - name: Run test run: bundle exec rake test + - id: build + run: | + rake build + echo "pkg=${GITHUB_REPOSITORY#*/}-${RUNNING_OS%-*}" >> $GITHUB_OUTPUT + env: + RUNNING_OS: ${{matrix.os}} + if: needs.ruby-versions.outputs.latest == matrix.ruby + - name: Upload package + uses: actions/upload-artifact@v4 + with: + path: pkg/* + name: ${{steps.build.outputs.pkg}} + if: steps.build.outputs.pkg diff --git a/Gemfile b/Gemfile index 43ff9f2..7f1d99c 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,8 @@ source "https://rubygems.org" # Specify your gem's dependencies in time.gemspec gemspec -gem "rake", "~> 12.0" -gem "test-unit" -gem "test-unit-ruby-core" +group :development do + gem "rake", "~> 12.0" + gem "test-unit" + gem "test-unit-ruby-core" +end diff --git a/rakelib/epoch.rake b/rakelib/epoch.rake new file mode 100644 index 0000000..80f27c9 --- /dev/null +++ b/rakelib/epoch.rake @@ -0,0 +1,5 @@ +task "build" => "date_epoch" + +task "date_epoch" do + ENV["SOURCE_DATE_EPOCH"] = IO.popen(%W[git -C #{__dir__} log -1 --format=%ct], &:read).chomp +end diff --git a/time.gemspec b/time.gemspec index a9349a2..4b9f9e1 100644 --- a/time.gemspec +++ b/time.gemspec @@ -20,8 +20,12 @@ 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)/}) } + srcdir, gemspec = File.split(__FILE__) + spec.files = Dir.chdir(srcdir) do + `git ls-files -z`.split("\x0").reject { |f| + f == gemspec or + f.start_with?(".git", "bin/", "test/", "rakelib/", "Gemfile", "Rakefile") + } end spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }