forked from ONLYOFFICE/build_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
24 lines (21 loc) · 804 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true
desc 'Cleanup old build files'
task :clean do
archive_name_pattern = 'build_tools*.tar.gz'
sh('sudo rm -rf out')
sh("rm #{archive_name_pattern}") unless Dir.glob(archive_name_pattern).empty?
end
desc 'Build version anew'
task build: :clean do
sh('mkdir out')
sh('docker build --tag onlyoffice-document-editors-builder .')
sh("docker run -v #{Dir.pwd}/out:/build_tools/out onlyoffice-document-editors-builder")
end
desc 'Archive current build version'
task :archive do
commit_hash = `git rev-parse --short HEAD`.strip
branch = `git rev-parse --abbrev-ref HEAD`.gsub('/', '_').strip
current_data = Time.now.strftime('%Y.%m.%d-%H.%M')
archive_name = "build_tools-#{branch}-#{commit_hash}-#{current_data}.tar.gz"
sh("tar -zcvf #{archive_name} out")
end