[ci] Fix timezones for dates to use commiter timezones
- Add irb as dev dependency
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -4,3 +4,6 @@ source "https://rubygems.org"
|
||||
|
||||
gem "rugged", "~> 1.4"
|
||||
gem "liquid", "~> 5.3"
|
||||
|
||||
gem "irb", "~> 1.4", :group => [:development]
|
||||
gem "rdoc", "~> 6.4", :group => [:development]
|
||||
|
||||
12
Gemfile.lock
12
Gemfile.lock
@@ -1,14 +1,26 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
io-console (0.5.11)
|
||||
irb (1.4.1)
|
||||
reline (>= 0.3.0)
|
||||
liquid (5.3.0)
|
||||
psych (4.0.4)
|
||||
stringio
|
||||
rdoc (6.4.0)
|
||||
psych (>= 4.0.0)
|
||||
reline (0.3.1)
|
||||
io-console (~> 0.5)
|
||||
rugged (1.4.2)
|
||||
stringio (3.0.2)
|
||||
|
||||
PLATFORMS
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
irb (~> 1.4)
|
||||
liquid (~> 5.3)
|
||||
rdoc (~> 6.4)
|
||||
rugged (~> 1.4)
|
||||
|
||||
BUNDLED WITH
|
||||
|
||||
26
update.rb
26
update.rb
@@ -18,7 +18,6 @@ DEFAULT_TAG_TEMPLATE = '{{major}}.{{minor}}{% if patch %}.{{patch}}{%endif%}'
|
||||
|
||||
def fetch_git_releases(repo_dir, url)
|
||||
pwd = Dir.pwd
|
||||
puts "Fetching #{url}"
|
||||
`git init --bare #{repo_dir}` unless Dir.exist? repo_dir
|
||||
Dir.chdir repo_dir
|
||||
`git fetch --quiet --tags --filter=blob:none "#{url}"`
|
||||
@@ -46,14 +45,23 @@ def update_git_releases(repo_dir, output_file, auto_config)
|
||||
|
||||
tag_proper_name = render_tag(tag.name, auto_config)
|
||||
|
||||
if tag.target.is_a? Rugged::Tag::Annotation
|
||||
data[tag_proper_name] = tag.target.tagger[:time].strftime('%F')
|
||||
# If the tag has an annotation, we get accurate time information
|
||||
# from the tag annotation "tagger"
|
||||
begin
|
||||
if tag.annotated?
|
||||
# We pick the data from the "tagger" which includes offset information
|
||||
t = tag.annotation.tagger[:time]
|
||||
data[tag_proper_name] = t.strftime('%F')
|
||||
puts "#{tag_proper_name}: #{t.strftime('%F %X %z')}"
|
||||
else
|
||||
begin
|
||||
data[tag_proper_name] = tag.target.time.strftime('%F')
|
||||
rescue StandardError
|
||||
puts "[WARN] No timestamp for #{tag.name}"
|
||||
end
|
||||
# In other cases, we de-reference the tag to get the commit
|
||||
# and use the date of the commit itself
|
||||
t = tag.target.committer[:time]
|
||||
data[tag_proper_name] = t.strftime('%F')
|
||||
puts "#{tag_proper_name}: #{t.strftime('%F %X %z')}"
|
||||
end
|
||||
rescue StandardError
|
||||
puts "::warning No timestamp for #{tag.name}, ignoring"
|
||||
end
|
||||
end
|
||||
File.open(output_file, 'w') do |file|
|
||||
@@ -98,8 +106,10 @@ Dir.glob("#{WEBSITE_DIR}/products/*.md").each do |product_file|
|
||||
next if OPTIONAL_PRODUCT && (OPTIONAL_PRODUCT != product)
|
||||
|
||||
if data['auto']['git']
|
||||
puts "::group::#{product}"
|
||||
fetch_git_releases(get_cache_dir('git', product), data['auto']['git'])
|
||||
update_git_releases(get_cache_dir('git', product), get_output_file('git', product), data['auto'])
|
||||
puts "::endgroup::"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user