Skip to content

Commit

Permalink
Merge pull request #15 from ruby/package
Browse files Browse the repository at this point in the history
Package
  • Loading branch information
nobu authored Mar 6, 2024
2 parents 811a941 + ad20fd9 commit fe19377
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions rakelib/epoch.rake
Original file line number Diff line number Diff line change
@@ -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
8 changes: 6 additions & 2 deletions time.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down

0 comments on commit fe19377

Please sign in to comment.